Bill, thanks very much, the solution you gave me works very fine. Good Day Zilore
--- On Fri, 5/8/09, Bill Luebkert <[email protected]> wrote: > From: Bill Luebkert <[email protected]> > Subject: Re: search and replace > To: [email protected] > Cc: [email protected] > Date: Friday, May 8, 2009, 11:50 AM > zilore mumba wrote: > > Hello Perl community, > > Once more excuse me for asking something very basic. I > have a file which has five-digit strings. Some of the groups > may contains from one to five slashes, as below. > > ///// ///// 92765 15426 679// 28011 10660 831// > > > > In the code below I am reading from file1, replacing > every occurence of / by 9 and rewriting the strings in > file2, and deleting original file1. I am getting an error as > "use of uninitialised value is substitution s///" > indicating the error is on the line with "$slashes =~ > s/\/{1,5}/9{1,5}/g;". > ... > > open (OUT1, > > open (OUT2, > > I'd change OUT1 and OUT2 to IN and OUT. > > > for my $i (@slashes) { > > $slashes =~ s/\/{1,5}/9{1,5}/g; > > } > > $slashes isn't set anywhere. > $_ contains each line of @slashes by default, so: > > for (@slashes) { > s/\//9/g; > } > > would be apropos. > _______________________________________________ > ActivePerl mailing list > [email protected] > To unsubscribe: > http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
