Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Hash of Regex

by almut (Canon)
on Apr 06, 2010 at 22:19 UTC ( #833139=note: print w/replies, xml ) Need Help??


in reply to Re: Hash of Regex
in thread Hash of Regex

$VAR1 = { 'int' => 'float', 'brown' => 'yellow' };

(note to the OP)  In case you wonder why this is:

my %dict = ( 'brown' => 'yellow', /int(\d+)/ => 'int', /float(\d+)/ => 'float', );

is the same as

my %dict = ( 'brown' => 'yellow', $_ =~ /int(\d+)/ => 'int', $_ =~ /float(\d+)/ => 'float', );

which (in this case) is the same as

my %dict = ( 'brown' => 'yellow', () => 'int', () => 'float', );

which is the same as

my %dict = ( 'brown' => 'yellow', 'int' => 'float', );

Replies are listed 'Best First'.
Re^3: Hash of Regex
by Anonymous Monk on Apr 06, 2010 at 22:49 UTC
    Why / how did this
    my %dict = ( 'brown' => 'yellow', () => 'int', () => 'float', );
    become this??
    my %dict = ( 'brown' => 'yellow', 'int' => 'float', );
      For Perl => is just a comma, and empty lists () are ignored when flattening lists.

      perl -e' @a=(1,2,(),(),3);print "@a"' 1 2 3

      Cheers Rolf

      Empty elements (lists) in a list collapse,  e.g. (1, (), 2, 3, (), (), 4) is the same as (1, 2, 3, 4).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://833139]
help
Chatterbox?
[mark4]: I installed "PAR" from the ppm install window. pp.exe. did not show up.
[marto]: it should just be a script, pp, or on windows pp.bat, post install you should just be able to call pp -x packed.exe source.pl as the PPM package should put everything required into the appropriate path
[marto]: ah, some time ago pp became it's own package, try searching your repo for PAR::Packer
[marto]: again, Strawberry + cpanm for the win: cpanm pp to install

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2018-01-19 14:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (218 votes). Check out past polls.

    Notices?