Re: [OT] Re: Regex find and replace - delete line

2006-07-26 Thread Rob Dixon
Chad Perrin wrote: On Mon, Jul 24, 2006 at 07:35:03PM -0400, Mathew Snyder wrote: Please lighten up. How many lumens is that? Lumens are immaterial as they are undirected. We want as many candela as possible over the solid angle that is perl.beginners. # Lighten up: $candela++; ;>

Re: Regex find and replace - delete line

2006-07-26 Thread James Turnbull
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 D. Bolliger wrote: > Chad Perrin am Sonntag, 23. Juli 2006 14:11: > >> On Sun, Jul 23, 2006 at 01:53:35PM +0200, D. Bolliger wrote: >> >>> If you want to delete entries from @file completely... >>> >>> a) that _equal_ to 'foo' (and the entry

Re: [OT] Re: Regex find and replace - delete line

2006-07-24 Thread Chad Perrin
On Mon, Jul 24, 2006 at 07:35:03PM -0400, Mathew Snyder wrote: > Please lighten up. How many lumens is that? (Please don't top-post.) -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] "There comes a time in the history of any project when it becomes necessary to shoot the engineers and b

Re: [OT] Re: Regex find and replace - delete line

2006-07-24 Thread Mathew Snyder
Please lighten up. Mathew Snyder D. Bolliger wrote: Randal L. Schwartz am Montag, 24. Juli 2006 09:39: "D> . . . we have 34 degrees here 34 degrees of what? Celsius. I'll include the following disclaimer in further posts: DISCLAIMER: Please excuse my bad english. How many radians is

RE: Regex find and replace - delete line

2006-07-24 Thread Smith, Derek
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Ahhh yes...thank you for the pointing out the oversights => qw instead of qq and removing the commas. ___

Re: Regex find and replace - delete line

2006-07-24 Thread D. Bolliger
Smith, Derek am Montag, 24. Juli 2006 22:03: > -Original Message- > From: John W. Krahn [mailto:[EMAIL PROTECTED] > Sent: Monday, July 24, 2006 3:36 PM > To: Perl Beginners > Subject: Re: Regex find and replace - delete line > > Chris Charley wrote: > > -

RE: Regex find and replace - delete line

2006-07-24 Thread Smith, Derek
-Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Monday, July 24, 2006 3:36 PM To: Perl Beginners Subject: Re: Regex find and replace - delete line Chris Charley wrote: > > - Original Message - From: ""John W. Krahn"" <[EMAIL

Re: Regex find and replace - delete line

2006-07-24 Thread John W. Krahn
Chris Charley wrote: > > - Original Message - From: ""John W. Krahn"" <[EMAIL PROTECTED]> >> >> And if you want to do it with one loop: >> >> >> for my $i ( reverse 0 .. $#file ) { >> splice @file, $i, 1 if /foo/; >> } > > Hi John > > Shouldn't the above read like: > > for my $i ( reve

Re: Regex find and replace - delete line

2006-07-24 Thread Chris Charley
- Original Message - From: ""John W. Krahn"" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: "Perl Beginners" Sent: Sunday, July 23, 2006 4:33 PM Subject: Re: Regex find and replace - delete line James Turnbull wrote: Hi all Hello, This f

[OT] Re: Regex find and replace - delete line

2006-07-24 Thread D. Bolliger
Randal L. Schwartz am Montag, 24. Juli 2006 09:39: > "D> . . . we have 34 degrees here > > 34 degrees of what? Celsius. I'll include the following disclaimer in further posts: DISCLAIMER: Please excuse my bad english. > How many radians is that? Please don't hijack threads with new questions

Re: Regex find and replace - delete line

2006-07-24 Thread Randal L. Schwartz
> ""D" == "D Bolliger" <[EMAIL PROTECTED]> writes: "D> . . . we have 34 degrees here 34 degrees of what? How many radians is that? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical wri

Re: Regex find and replace - delete line

2006-07-23 Thread Rob Dixon
John W. Krahn wrote: As you have seen when using Tie::File removing the contents of a line do not remove that line. You have to splice the tied array: my $line_to_remove; for my $i ( 0 .. $#file ) { $line_to_remove = $i if /foo/; } splice @file, $line_to_remove, 1; If you have more than o

Re: Regex find and replace - delete line

2006-07-23 Thread John W. Krahn
James Turnbull wrote: > Hi all Hello, > This feels like a really dumb question but doing a regex find and > replace is it possible to delete a line? For example, > > for (@file) { > s/foo//g; > } > > which equates to: > > for each element in array 'file' if you find 'foo' then replace it wi

Re: Regex find and replace - delete line

2006-07-23 Thread D. Bolliger
Chad Perrin am Sonntag, 23. Juli 2006 14:11: > On Sun, Jul 23, 2006 at 01:53:35PM +0200, D. Bolliger wrote: > > If you want to delete entries from @file completely... > > > > a) that _equal_ to 'foo' (and the entry does not contain a line ending): > > > > @file=grep { $_ eq 'foo' } @file; > > If I'

Re: Regex find and replace - delete line

2006-07-23 Thread Chad Perrin
On Sun, Jul 23, 2006 at 01:53:35PM +0200, D. Bolliger wrote: > > If you want to delete entries from @file completely... > > a) that _equal_ to 'foo' (and the entry does not contain a line ending): > > @file=grep { $_ eq 'foo' } @file; If I'm missing something, I blame the fact that it's only si

Re: Regex find and replace - delete line

2006-07-23 Thread D. Bolliger
James Turnbull am Sonntag, 23. Juli 2006 08:01: > Hi all Hi James > This feels like a really dumb question but doing a regex find and > replace is it possible to delete a line? For example, The example below does not handle lines, but array entries (the entries may be used as lines in the exte