Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: Re: Re: Storing Substitution Output String

by little (Curate)
on Jul 14, 2002 at 20:08 UTC ( #181641=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re: Storing Substitution Output String
in thread Storing Substitution Output String

say your text is in a string (or an array of strings) then I would use grep and map :-) to get a list of all matches nicely formatted as list items, but for sure there is an easier way which refuses to come to my mind now :-)

perhaps this might do :-)

# the substitution is none in effect, it just digs around $page2 =~ s|<title>(.*)</title>|${my_count(\$1)}|gi; my matches = (); sub my_count { my $occurance = shift; push @matches, ${$occurance} ; return $occurance; } # see what we've got foreach (@matches) { print '<li>'.$_.'</li>'."\n"; # just to format the output :-) }

Have a nice day
All decision is left to your taste

Update

fixed stupid error in the substitutional part where I inserted the '<title>' again.


Comment on Re: Re: Re: Re: Storing Substitution Output String
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (15)
As of 2015-07-31 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls