iphone has asked for the wisdom of the Perl Monks concerning the following question:
I have a hash like below,values are in an array,some values of array are comments,now I want to add a check not to print the comments.I treid the below but not successful $VAR1 = { 'file.txt' => [ 'pages/value/data.h ', '@label ', '/* CAT/APP/file.c */ ', };
for my $key (keys %Hash) { my $value = $Hash{$key}; if(@$value !=~ /^\/\*/) #if the value is a comment donot print + it. { if (scalar @$value) { # check that the arrayref isn't empty print "\n ", join(", ", @$value), "\n\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I stop printing a hash value
by ikegami (Patriarch) on Dec 18, 2010 at 01:02 UTC | |
by iphone (Beadle) on Dec 18, 2010 at 01:07 UTC | |
by ww (Archbishop) on Dec 18, 2010 at 01:58 UTC | |
by iphone (Beadle) on Dec 18, 2010 at 01:29 UTC | |
|
Re: How do I stop printing a hash value
by PeterPeiGuo (Hermit) on Dec 18, 2010 at 01:45 UTC | |
by iphone (Beadle) on Dec 18, 2010 at 01:58 UTC | |
by PeterPeiGuo (Hermit) on Dec 18, 2010 at 02:09 UTC | |
by iphone (Beadle) on Dec 18, 2010 at 05:41 UTC |