Re: Editing file

2009-03-21 Thread Chas. Owens
On Sat, Mar 21, 2009 at 14:36, Gunnar Hjalmarsson wrote: > Chas. Owens wrote: >> >> There is also the ongoing danger of putting untrusted file names in >> @ARGV[4], > > $ perl -we "undef @ARGV[4]" > Scalar value @ARGV[4] better written as $ARGV[4] at -e line 1. > $ > > Maybe your previous footnote

Re: Editing file

2009-03-21 Thread Gunnar Hjalmarsson
Chas. Owens wrote: There is also the ongoing danger of putting untrusted file names in @ARGV[4], $ perl -we "undef @ARGV[4]" Scalar value @ARGV[4] better written as $ARGV[4] at -e line 1. $ Maybe your previous footnote style was better after all. ;-) -- Gunnar Hjalmarsson Email: http://www.gu

Re: Editing file

2009-03-21 Thread Gunnar Hjalmarsson
Randal L. Schwartz wrote: "Gunnar" == Gunnar Hjalmarsson writes: Gunnar> Martin Spinassi wrote: Is there any way to open a file for input and output at the same time? Gunnar> Yes. Open it with the '+<' MODE. Gunnar> open my $fh, '+<', $file or die "Couldn't open $file: $!"; Gunnar>

Re: Editing file

2009-03-21 Thread Chas. Owens
On Sat, Mar 21, 2009 at 11:05, Randal L. Schwartz wrote: >> "Gunnar" == Gunnar Hjalmarsson writes: > > Gunnar> Martin Spinassi wrote: >>> Is there any way to open a file for input and output at the same time? > > Gunnar> Yes. Open it with the '+<' MODE. > > Gunnar>     open my $fh, '+<', $fil

Re: Editing file

2009-03-21 Thread Randal L. Schwartz
> "Gunnar" == Gunnar Hjalmarsson writes: Gunnar> Martin Spinassi wrote: >> Is there any way to open a file for input and output at the same time? Gunnar> Yes. Open it with the '+<' MODE. Gunnar> open my $fh, '+<', $file or die "Couldn't open $file: $!"; Gunnar> my @keep; Gunnar>

Re: Editing file

2009-03-20 Thread Martin Spinassi
On Fri, 2009-03-20 at 11:07 -0700, John W. Krahn wrote: > Martin Spinassi wrote: > > Hi list! > > Hello, > > > I've just started with perl, but I'm really excited about its power. > > I'm excited that you're excited! ;-) I'm excited because you are excited because I'moryou. doesn't

Re: Editing file

2009-03-20 Thread Martin Spinassi
On Fri, 2009-03-20 at 18:48 +0100, Gunnar Hjalmarsson wrote: > Martin Spinassi wrote: > > Is there any way to open a file for input and output at the same time? > > Yes. Open it with the '+<' MODE. > > open my $fh, '+<', $file or die "Couldn't open $file: $!"; > my @keep; > while (

Re: Editing file

2009-03-20 Thread John W. Krahn
Martin Spinassi wrote: Hi list! Hello, I've just started with perl, but I'm really excited about its power. I'm excited that you're excited! ;-) I'm trying to edit a file, but couldn't find out how to do it without making a temp file. I've been searching for the solution, but all I find

Re: Editing file

2009-03-20 Thread Gunnar Hjalmarsson
Martin Spinassi wrote: Is there any way to open a file for input and output at the same time? Yes. Open it with the '+<' MODE. open my $fh, '+<', $file or die "Couldn't open $file: $!"; my @keep; while ( <$fh> ) { next if /^--/; push @keep, $_; } seek $fh, 0

Editing file

2009-03-20 Thread Martin Spinassi
Hi list! I've just started with perl, but I'm really excited about its power. I'm trying to edit a file, but couldn't find out how to do it without making a temp file. I've been searching for the solution, but all I find is how to do it from command line, adding a "-i" to the execution. My scrip