in reply to Re: Ogg Vorbis tag parsing in pure perl
in thread OGG Vorbis tag parsing in pure perl

Aristotle,

I don't understand the map syntax used in your code example.
I know you marked this as untested, but thought I would ask for clarification
in case this was not a typo of some sort and I was missing something.
Does the "map +( )" syntax have a special purpose? I was unable to get the code to work as is,
and I had to modify my version a bit to get it to work.

my %info = map { $_ => $buffer =~ /$_=([^=]+)/i } qw(artist title albu +m genre comment);

Any help is much appreciated, as always.
Wonko.

Replies are listed 'Best First'.
Re^3: Ogg Vorbis tag parsing in pure perl
by Aristotle (Chancellor) on Dec 31, 2002 at 17:11 UTC
    No real difference. The + is just there as a hint for Perl that what's in the parens should be map's expression, not a parenthesized list of arguments much like you might say print +($x + 1) * 3; to get the meaning of print(($x + 1) * 3); rather than the default parsing result of (print($x + 1)) * 3;. I've had success making it work that way for map, but apparently the rules are not quite so simple as I thought. Functionally, it's supposed to be just the equivalent to what you used. It just bugged me to have to use a BLOCK whenever I'm mapping an array to a hash.

    Makeshifts last the longest.