hmm, well, I see what it printed but I'm not sure if I defined the empty-string key in the hash as you have asked me, did I do it correctly?.
If I add a space in between the tick marks then the hash returns
this is INDEX =>bernini
If no space between the ticks then match hash returns nothing.
can you explained why even when the empty string(space in it) ' ' returns the key when there's not space in the $string that's being checked against??
ok, I am have to read more on the index.
I appreciate the well detailed explanationsthank you
my $string = 'abcdefghijk'; my %match = (' '=>"bernini",bc => "Michelangelo", efg => "Raffaello",d +e => "Caravaggio",ijk => "Tintoretto",hij=>"Leonardo",);
foreach $art (keys %match){ print "this is INDEX $art =>",join(',',$match{$art}),"\n", if inde +x $string,$art; }
In reply to Re^5: find a substring of unknow lenght if it is in a hash
by perlynewby
in thread find a substring of unknow lenght if it is in a hash
by perlynewby
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |