in reply to •Re: Re: Perl & C/C++
in thread Perl & C/C++

Any reason not to just use a lexical variable for the handle? You can also get rid of the $1 if since push imposes list context on the regex anyway.
my @COLOR; { open my $fh, "<", "/usr/lib/X11/rgb.txt" or last; push @COLOR, /\d+\s+\d+\s+\d+\s+(\S+)/ while <$fh>; }

Makeshifts last the longest.

Replies are listed 'Best First'.
•Re: Re^3: Perl & C/C++ (lexical filehandle?)
by merlyn (Sage) on Mar 31, 2003 at 00:35 UTC