Hi , I use the following simple perl script to find the yesterday time
perl -e ' use POSIX(strftime); print POSIX::strftime("%a %b %e %H:%M:%S %Y", localtime(time-86400*$ARGV[0]))' 1
However in the perl version 4 , it gives me the following error :
syntax error in file /tmp/perl-eK4elEa at line 1, next 2 tokens "use POSIX"
syntax error in file /tmp/perl-eK4elEa at line 1, next 2 tokens "POSIX:"
Execution of /tmp/perl-eK4elEa aborted due to compilation errors.
Do the perl version 4 does not support use POSIX???
Hi Dude,
This script is working fine for me,when I tried it in AIX box,having perl 5.8.2 version.
abcd4dev# perl -e ' use POSIX(strftime); print POSIX::strftime("%a %b %e %H:%M:%S %Y", localtime(time-86400*$ARGV[0]))' 1
Wed Oct 29 09:53:24 2008
abcd4dev# perl -v
This is perl, v5.8.2 built for aix-thread-multi
(with 2 registered patches, see perl -V for more detail)
Copyright 1987-2003, Larry Wall
But unfortunately I dont have an environment with Perl version 4 to test this.
otheus
October 30, 2008, 6:27am
3
Version 4 does not support "use". You can try
BEGIN { require POSIX; }
but there's a good chance that won't work. The package probably uses too many perl5-specific mechanisms.
Consider migrating to Perl 5. The Perl community no longer supports the version 4 for so long that you are unlikely to get too much feedback. You can often install perl at another directory (even as user-level) for running specific scripts that require a specific version so that the original system-wide perl installation is untouched. Then you can fully leverage what is on CPAN, and more.
otheus
October 30, 2008, 12:22pm
5
Out of curiosity, Is this an embedded system or such? What still runs perl4? Or did you find a UNIX system whilst on an archaeological dig in Montana?