Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Storing Substitution Output String

by mrbbking (Hermit)
on Jul 14, 2002 at 17:49 UTC ( #181608=note: print w/ replies, xml ) Need Help??

in reply to Storing Substitution Output String

s///; returns the string sent to it if no substitutions actually happened.

You might try something like this:

#!usr/bin/perl -w use strict; my $page2 = ''; while( <DATA> ){ if( s!<title>(.*)</title>!<li>A$1C</li>!gi ){ $page2 .= $_; } } print $page2; __DATA__ <title>first story</title> This story is short. <title>second story</title> This story is longer. But not much longer.
I used a ! instead of the / as the delimiters, so I could leave the literal slashes alone in the regex.

Comment on Re: Storing Substitution Output String
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2015-11-28 02:34 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (737 votes), past polls