Hi Melvin,

It looks like you're editing each line but not writing back to the file,
add some print's or say's for $line to see what's happening.

Sincerely,
David Kronheim
Production Support Tier II
Gateway Error Correction, VZ450 EDI, EDI Billing, & Metakey/LIA
484-213-1315
________________________________________
From: Melvin [whereismel...@gmail.com]
Sent: Thursday, December 15, 2011 10:36 AM
To: beginners@perl.org
Subject: Replace words in a file using perl script

Hi,

I am a Perl baby :-)

I was trying to write a script to replace baby to bigboy in a file:-
However the below script doesn't work Could someone help me???

#!/usr/bin/perl -w
use strict;

open (FILE_IN , $ARGV[0]) || die ("ERROR: Gimme Input pleease");

my @array_of_lines = <FILE_IN>;

foreach my $line (@array_of_lines)

{
$line =~ s/baby/bigboy/g;

}

close FILE_IN;


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

This communication is confidential.  Frontier only sends and receives email on 
the basis of the terms set out at http://www.frontier.com/email_disclaimer.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to