Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: searching a scalar for a word. Should I use grep?

by kevyt (Scribe)
on Jun 23, 2007 at 04:39 UTC ( [id://622954]=note: print w/replies, xml ) Need Help??


in reply to Re: searching a scalar for a word. Should I use grep?
in thread searching a scalar for a word. Should I use grep?

Wow... thanks a bunch!!!! This worked !!!
Thanks for your very clear example.
I placed the prints on 2 - 3 lines for readability.
foreach $sic (keys %hash){ next if !$hash{$sic}{BUS}; print "str1 = $str[1] sic= $sic, cat= $hash{$sic}{CAT} bus= $hash{$sic}{BUS}\n"; if ( $str[1] =~ m/$hash{$sic}{BUS}/){ $str[38] = $hash{$sic}{CAT}; $str[39] = $sic; print "Found one. Bus name is $str[1] and cat is " . $hash{$sic}{CAT} . " and sic is " . $str[39] ."\n\n\n"; } }

output:
str1 = 'Domino''s Pizza' sic= 5812, cat= Pizza restaurants bus= Pizza Found one. Bus name is 'Domino''s Pizza' and cat is Pizza restaurants + and sic is 5812

Have a great weekend :)
Kevin

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://622954]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2026-01-22 13:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (125 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.