Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://181608]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2017-07-21 03:17 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (318 votes). Check out past polls.