Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Problem changing only first occurence of pattern in file

by japhy (Canon)
on Oct 17, 2006 at 13:25 UTC ( #578757=note: print w/replies, xml ) Need Help??


in reply to Problem changing only first occurence of pattern in file

You're looping more than you mean to. I think you want to pare your code down to just:
my $flag = 0; local ($^I, @ARGV) = (".bak", "/var/ww/htdocs/cgi-bin/user.txt"); while (<>) { $flag = 1 if !$flag and s/\|No$/|Yes/; print; }

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-05-21 00:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?