Scott R. Godin wrote:
> John W. Krahn wrote:
> >
> > Yes, there is.  :-)
> >
> > my %hash = do { local $/; <FH> =~ /[^\n,]+/g };
>
> Holy Handgrenades, Batman!
>
> but where's the implicit split of key and value there? forgive me for
> asking, but I just don't see it. is there some magic going on here?

Hi Scott.

May the apprentice answer for the master?

The %hash = puts /[^\n,]+/g into list context, which therefore
returns a list of all the matches. The regex matches all contiguous
strings of characters excluding comma and newline, so will
effectively split at both and return two fields per file record.
local $/, of course, enable slurp mode and reads the entire
file into a single string.

Did I pass?

Rob




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

Reply via email to