On Dec 14, 2007 6:02 AM, Jase Critchley <[EMAIL PROTECTED]> wrote: > I'm having to use an old version of perl on some systems and it doesnt like > the format of the open > > my $file = shift @ARGV || 'cpuuse.out'; > > open my $fh, '<', $file or die $!; > > Is there another way of opening the file in the same way but different code? > > Thanks, > Jase snip
Sounds like you have a pre-5.6 version of Perl. It is probably 5.005 (which was the version before 5.6, the version scheme change slightly). You will have to use the old bareword style open on those machines: open FH, "<$file" or die "could not open $file:$!"; Note that it is also taking only two arguments. This can be an issue if the file name starts with any special characters. You will also have problems with other common modern Perl syntax and some regexes. I would consider it a priority to upgrade the version of Perl on those boxes. It might not be wise to replace the version in /usr (there may be other software dependent on that version), so most people install the new version into /usr/local or /opt. At that point, you can start using the new version by putting #!/usr/local/bin/perl or #!/opt/perl/bin/perl or whatever the path to the new executable is on the first line. You can get the latest version of Perl at http://www.cpan.org/src/README.html. If you (or your sysadmins) wish to have a precompiled version of Perl, ActiveState has a binary version for most operating systems in common use, but some of them are not free. Their website is activestate.com. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/