Re: file handle in perl

2009-06-18 Thread perl pra
you can also Tie::File. On Wed, Jun 17, 2009 at 2:42 PM, Irfan Sayed wrote: > Hi All, > > I am struggling with file handling in perl. i want to do following > operation . > > 1: open the file > 2: read the file > 3: do the changes in specific lines > 4: save the file > 5: close the file > > i am

Re: file handle in perl

2009-06-17 Thread Telemachus
On Wed Jun 17 2009 @ 3:42, Ajay Kumar wrote: > Hi Irfan > You can do all four task like below > > 1: open FILE ,">filename.txt" or die$!; > 2: my @lines= > 3: do changes through sed > Like sed -e 's/original pattern/new pattern/p' filename > 4:if you did changes it automatically get saved

Re: file handle in perl

2009-06-17 Thread Irfan Sayed
uot;$chver\n"; while () {       if ($_ =~ m/"OutputFilename"/) {     $_ =~ s/(\d*.\d*.\d*).msi/$chver.msi/;     print OUT "$_\n";    }     } close FILE; } From: Irfan Sayed To: "beginners@perl.org" Sent: Wednesday, June 17, 2009 4:02:47 PM Subje

Re: file handle in perl

2009-06-17 Thread Irfan Sayed
thanks all From: Ajay Kumar To: Irfan Sayed Cc: "beginners@perl.org" Sent: Wednesday, June 17, 2009 3:42:41 PM Subject: RE: file handle in perl Hi Irfan You can do all four task like below 1: open FILE ,">filename.txt" or die$!; 2: m

RE: file handle in perl

2009-06-17 Thread Ajay Kumar
Hi Irfan You can do all four task like below 1: open FILE ,">filename.txt" or die$!; 2: my @lines= 3: do changes through sed Like sed -e 's/original pattern/new pattern/p' filename 4:if you did changes it automatically get saved 5: close(FILE); Thanks Ajay -Original Message- Fr

Re: file handle in perl

2009-06-17 Thread Raymond Wan
Hi Irfan, Irfan Sayed wrote: I am struggling with file handling in perl. i want to do following operation . 1: open the file 2: read the file 3: do the changes in specific lines 4: save the file 5: close the file Does this FAQ help? Q: How do I change, delete, or insert a line in a file,