Re: writing back to a file

2003-08-31 Thread John W. Krahn
Kevin Pfeiffer wrote: > > In article <[EMAIL PROTECTED]>, John W. Krahn wrote: > > [orig. question clipped] > > > > > The simplest way I could think of doing that would be: > > > > use warnings; > > use strict; > > use Tie::File; > > use Fcntl ':flock'; > > > > my $source_file = 'searchandreplac

Re: writing back to a file

2003-08-31 Thread Kevin Pfeiffer
In article <[EMAIL PROTECTED]>, John W. Krahn wrote: [orig. question clipped] > > The simplest way I could think of doing that would be: > > use warnings; > use strict; > use Tie::File; > use Fcntl ':flock'; > > my $source_file = 'searchandreplace.txt'; > > my $t = tie my @data, 'Tie::File',

Re: writing back to a file

2003-08-20 Thread Gabriel Cooper
try this: my $source_file = "searchandreplace.txt"; open(IN,"<$source_file") || die "can't open file: $1"; while() { $row = $_; $row =~ s/\s+\w+//i; push(@arr, $row); } close(IN); open(OUT,">$source_file" ) || die "can't open file: $1"; foreach (@arr) { print O

RE: writing back to a file

2003-08-20 Thread Darbesio Eugenio
AN wrote: >>>Hi, >>>Newbie here. I am writing a program that takes a file that has two columns >>>of words, extracts the second column, then saves the original file with only >>>the data in the first column. >>>Question #1 - would it be better to do this w/ the split or s/// functions ? >>>Ques

Re: writing back to a file

2003-08-20 Thread John W. Krahn
Absolut Newbie wrote: > > Hi, Hello, > Newbie here. I am writing a program that takes a file that has two columns > of words, extracts the second column, then saves the original file with only > the data in the first column. > > Question #1 - would it be better to do this w/ the split or s/// f

Re: writing back to a file

2003-08-20 Thread James Edward Gray II
On Wednesday, August 20, 2003, at 08:12 AM, Absolut Newbie wrote: Hi, Howdy. Newbie here. I am writing a program that takes a file that has two columns of words, extracts the second column, then saves the original file with only the data in the first column. Question #1 - would it be better t

writing back to a file

2003-08-20 Thread Absolut Newbie
Hi, Newbie here. I am writing a program that takes a file that has two columns of words, extracts the second column, then saves the original file with only the data in the first column. Question #1 - would it be better to do this w/ the split or s/// functions ? Question #1 - how do I write back