search and replace with an array

2012-02-20 Thread Chris Stinemetz
I am trying ot find a way to use an array as a reference to remove lines from a file. The array @keyFields has the elements "rcsm and cdmno". My objective is to remove any line from the input that matches the regex /rcsm\d/ and cdmno\d/. I'm not sure if I'm using the best approach. I am getting t

Re: search and replace with an array

2012-02-20 Thread Chris Stinemetz
Looks like I was able to figure it out with the below: But how do I remove all the blank lines? Output: cdmno=1 rdnt_cdmno=1 cdmno=2 rcsm=801 rcsm=801 rcsm=802 #!/usr/bin/perl use warnings; use strict; my $file = "nonKeys.txt"; my $newFile = "cleanKeys.txt"; my @keyFields

RE: search and replace with an array

2012-02-20 Thread Wagner, David --- Sr Programmer Analyst --- CFS
>-Original Message- >From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] >Sent: Monday, February 20, 2012 13:51 >To: beginners@perl.org >Subject: Re: search and replace with an array > >Looks like I was able to figure it out with the below: > >But how do I

RE: search and replace with an array

2012-02-20 Thread Ken Slater
> -Original Message- > From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] > Sent: Monday, February 20, 2012 3:51 PM > To: beginners@perl.org > Subject: Re: search and replace with an array > > Looks like I was able to figure it out with the below: > >

Re: search and replace with an array

2012-02-20 Thread John W. Krahn
Chris Stinemetz wrote: I am trying ot find a way to use an array as a reference to remove lines from a file. The array @keyFields has the elements "rcsm and cdmno". My objective is to remove any line from the input that matches the regex /rcsm\d/ and cdmno\d/. AND means matching BOTH in the sam

Re: search and replace with an array

2012-02-20 Thread Chris Stinemetz
Thank you everyone that replied. Your suggestions helped me with finding a solution. Take care, Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: search and replace with an array

2012-02-21 Thread Adams Paul
Sent from my LG phone "John W. Krahn" wrote: >Chris Stinemetz wrote: >> I am trying ot find a way to use an array as a reference to remove >> lines from a file. >> The array @keyFields has the elements "rcsm and cdmno". My objective >> is to remove any line from the input that matches the regex

Re: search and replace with an array

2012-02-21 Thread Shawn H Corey
On 12-02-21 11:37 AM, Adams Paul wrote: Sent from my LG phone Is this is what is called a bum dial? -- Just my 0.0002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. It's Mutual Aid, not fierce competition, that's the dom