Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: looking for a perl way to build a hash

by choroba (Bishop)
on Jul 26, 2013 at 14:11 UTC ( #1046521=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use warnings;
    ...
    
    my %hash2 = split /,/ => "$strA,$strB";
    print Dumper \%hash2;
    
  2. or download this
    my ($strA, $strB) = ("$str1,", "$str2,");
    my %hash = map { map substr($_, 0, -1),
    ...
                   } 1 .. $strA =~ tr/,//;
    
    print Dumper \%hash;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046521]
help
Chatterbox?
[hippo]: On my tab key the left pointing arrow is directly above the right-pointing arrow (and they are each pointing at a vertical line). It's a UK keyboard.
[Discipulus]: choroba thanks.. now i understand: like find the tresaure.. but in this case seems true: no one noticed
[Discipulus]: Happy-the-monk every Eatalian understand what ctrl+shift+tab means: we just have different names for # and @ ('cancelletto' and 'chiocciola')

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2017-11-21 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (297 votes). Check out past polls.

    Notices?