On Sat, 22 Jun 2002 11:06:58 -0700, [EMAIL PROTECTED] (Peter Scott) wrote:
>
>Don't read the entire file into memory; just change the next line to
>
>         while (<VS>) {
>           chomp;
>
>>foreach (@vs){
>>($name,$value) = split(/=/,$_);
>>$sigs{$name}=$value;}
>
>That code is clear enough (aside from the lack of indentation)... by 
>"clever" did you mean "shorter, even if more obfuscated"?  Okay:
>
>         @ARGV = 'vs';
>         my %sigs = map { chomp; split /=/ } <>;
>
>Yes... that does read the whole file into memory.  This one doesn't:
>
>         @ARGV = 'vs';
>         my %sigs;
>         /(.*?)=(.*)/ and $sigs{$1} = $2 while <>;

Brilliant!!!!!!!   I feel like I found a real gem today, another snippet
for the library.  Thanks.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to