Please note that I have rearranged the order of quotes for sanity. I hope that nobody minds or feels that I am misrepresenting the authors..
On Fri, Feb 17, 2012 at 10:58:45AM -0600, Hal Wigoda wrote: > On Fri, Feb 17, 2012 at 9:32 AM, lina <lina.lastn...@gmail.com> wrote: > > #!/usr/bin/perl > > > > use warnings; > > use strict; > > > > open FILE, "<try.xpm" or die $!; > > > > my @line = <FILE>; > > > > while (<FILE>) { > > print $_; > > } > > I don't know if this will fix it, > but line 6 is missing a closing >. Line 6 was: open FILE, "<try.xpm" or die $!; That is not missing a closing '>'. See `perldoc -f open'. The '<' means to open the file for reading. I think it is inspired by shell syntax for redirecting standard streams. bash$ foo <stdin >stdout 2>stderr Means to execute the program 'foo', with the file 'stdin' as it's standard input stream (for reading), the file 'stdout' as its standard output stream (for writing), and the file 'stderr' as it's standard error stream (also for writing). In Perl, depending on the number of arguments used, the second argument of the open function is used to determine which mode to open the file in. You should usually prefer the 3-argument version of open because it's often safer (even though in these examples below it wouldn't matter, it's still better to use it for consistency and habit). # Open file 'filename' for reading. open my $fh1, '<', 'filename' or die $!; # Open file 'filename' for writing. open my $fh2 '>', 'filename' or die $!; # Open file 'filename' for writing, and start the file position # at the end of the file for appending. open my $fh3, '>>', 'filename' or die $!; Again, see `perldoc -f open' for details. Regards, -- Brandon McCaig <bamcc...@gmail.com> <bamcc...@castopulence.org> Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'
signature.asc
Description: Digital signature