in reply to Re^4: find a substring of unknow lenght if it is in a hash
in thread find a substring of unknow lenght if it is in a hash
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: find a substring of unknow lenght if it is in a hash
by AnomalousMonk (Archbishop) on Jun 30, 2015 at 06:58 UTC |