Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: syntax questions

by AnomalousMonk (Canon)
on Mar 07, 2013 at 03:28 UTC ( #1022139=note: print w/ replies, xml ) Need Help??

in reply to Re: syntax questions
in thread syntax questions

open my $filelist, '>', $filelist or die "Can't open $filelist: $!";

This is simply an inadvertance, but using a new lexical  my $filelist for the filehandle in the open statement masks the file name in the old lexical of the same name (and also generates a warning if warnings are enabled, which is strongly recommended). I would write something like:

>perl -wMstrict -le "my $filelist = 'xyzzy'; open my $filehandle, '>', $filelist or die qq{opening '$filelist': $! +}; print $filehandle $_ for qw(foo bar baz); close $filehandle or die qq{closing '$filelist': $!}; " >type xyzzy foo bar baz

Comment on Re^2: syntax questions
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022139]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-11-30 19:35 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (778 votes), past polls