Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^5: no reaction on string replace

by poj (Prior)
on Sep 11, 2013 at 20:14 UTC ( #1053559=note: print w/replies, xml ) Need Help??

in reply to Re^4: no reaction on string replace
in thread no reaction on string replace

You don't need the foreach loop as you have for @lines.
#!/usr/bin/perl -w use strict; my $SCU = 'C:/Users/Desktop/a.txt'; open (FILE, '<', $SCU) or die "$SCU File not found : $!"; my @lines = <FILE>; close (FILE); my @newlines; #foreach(@lines) { push @newlines, s/test/xyz/rg for @lines; #} open (FILE, '>', $SCU) or die "Could not open file $SCU: $!"; print FILE @newlines; close (FILE);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053559]
[Discipulus]: good morning vietnam!
[Discipulus]: but there is some perl workshop somewhere? I notice many high level monks disappeared.. we can make PM a squat in the meantime ;=)
[karlgoethebier]: Discipulus: Mmh, who disappeared?
[marto]: morning all
[shmem]: perl -lE '$_="odd mornin";($o=$_)=~ s/^|$/g/g;say$o'
[Eily]: Hi monks o/
[choroba]: 3 PM in Vietnam, BTW
Discipulus maybe a wrong impression..

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2017-06-27 08:08 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (600 votes). Check out past polls.