jeanluca has asked for the wisdom of the Perl Monks concerning the following question:
So, I'm looking for something likeuse warnings ; use strict ; my %h = ( 'a' => 1, 'b' => 1, 'c' => 1 ) ; my $str ; foreach ( keys %h ) { $str .= "$_ " } xyz( $str ) ; sub xyz { print shift ; }
Doesn't work of course!use warnings ; use strict ; my %h = ( 'a' => 1, 'b' => 1, 'c' => 1 ) ; xyz( "keys(%h)" ) ; sub xyz { print shift ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: need all keys from hash into one string (looking for 1-liner)
by derby (Abbot) on Jul 11, 2007 at 14:05 UTC | |
|
Re: need all keys from hash into one string (looking for 1-liner)
by xdg (Monsignor) on Jul 11, 2007 at 14:05 UTC | |
|
Re: need all keys from hash into one string (looking for 1-liner)
by almut (Canon) on Jul 11, 2007 at 14:08 UTC |