Re: A multi line pattern match question

2016-07-14 Thread Andrew Solomon
Hi Darryl After all that I must confess that when I'm making config changes to multiple servers, I use Rex: http://rexify.org/ https://metacpan.org/pod/Rex which is something like Puppet-lite:) Andrew On Thu, Jul 14, 2016 at 11:04 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote

RE: A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
I settled for an set of stacked if statements, saving the previous line if needed etc... Thanks for the help. Darryl Baker PMOET -DAPS X76674

Re: A multi line pattern match question

2016-07-14 Thread Charles DeRykus
One easier approach: use Tie::File; tie( my @array, 'Tie::File', "/path/to/file" ) or die $!; my $n = 0; while ( $n <= $#array ) { if ( $array[$n] =~ /.*[Oo]rder deny,allow(.*)/ and $n < $#array and $array[$n+1] =~ /[\Dd]eny from all(.*)/ ) { $n

Re: A multi line pattern match question

2016-07-14 Thread Omega -1911
On Thu, Jul 14, 2016 at 2:56 PM, Rob McAninch wrote: > > > On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > >> On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < >> darryl.ba...@northwestern.edu> wrote: >> >> While not truly a beginner it feels

Re: A multi line pattern match question

2016-07-14 Thread Rob McAninch
On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many yea

Re: A multi line pattern match question

2016-07-14 Thread Omega -1911
On Thu, Jul 14, 2016 at 1:24 PM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < > darryl.ba...@northwestern.edu> wrote: > > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many yea

RE: A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker wrote: While not truly a beginner it feels that way after not doing anything substantial in Perl in many years. I currently need a program to take Apache HTTPD configuration files in HTTPD 2.2 syntax used in current production and convert t

Re: A multi line pattern match question

2016-07-14 Thread Rob McAninch
On Thu, Jul 14, 2016 at 10:50 AM, Darryl Philip Baker < darryl.ba...@northwestern.edu> wrote: > While not truly a beginner it feels that way after not doing anything > substantial in Perl in many years. > > I currently need a program to take Apache HTTPD configuration files in > HTTPD 2.2 syntax u

A multi line pattern match question

2016-07-14 Thread Darryl Philip Baker
While not truly a beginner it feels that way after not doing anything substantial in Perl in many years. I currently need a program to take Apache HTTPD configuration files in HTTPD 2.2 syntax used in current production and convert them to HTTPD 2.4 syntax in future production. I will need to

Re: A multi line pattern match question

2016-07-14 Thread Andrew Solomon
I'm guessing the problem is the newline in the regex. If you want it to match across multiple lines, I think the /ms modifiers should do the trick. if ( m/{.*}[Oo]rder deny,allow(.*)\n(.*)[Dd]eny from all(.*)/ms) { NOTE: I haven't tried this myself!:) failing that, $ perldoc perlre may be o

Re: Pattern match operator

2013-05-04 Thread Jim Gibson
\d)?(PATTERN3)/; > and one of the patterns is not there, still everything will be shifted to the > right, won't it? I figured that by naming the captures, I will always know if > there was a match at the very position intended. If the regular expression does not match all three p

Re: Pattern match operator

2013-05-04 Thread Florian Huber
built-in variables that relate to regular expressions are modified by every successful pattern match. It is safer to save values that you may want to use later in a sperate variable. In particular, your regex m/(?AVG\s\d)/ matches and, because there is no capture named `GFP` it sets the correspondi

Re: Pattern match operator

2013-05-04 Thread Rob Dixon
{'GFP'} is $+{'GFP'}.\n"; print "\$+{'AVG'} is $+{'AVG'}.\n"; prints this: $+{'GFP'} is FILTERS GFP,GFP,100% ACTSHUT 17 AVG 4,1.00 WRT. $+{'AVG'} is . So now the match suddenly fails?!? Hello Florian First a couple of

Pattern match operator

2013-05-04 Thread Florian Huber
Hi all, I'm parsing a logfile and don't quite understand the behaviour of m//. From a previous regex match I have already captured $+{'GFP'}: use strict; use warnings; (...) $text =~ m/ (?FILTERS .*? WRT)/x;# I simply have my whole logfile in $text - I know there are better solutions.

Re: Unintended behavior: Range operator inside a while loop continues to pattern match on the subsequent file

2011-04-21 Thread Marc Perry
up > >if ( eof ) { > > close ARGV; > > $accumulator = ''; > > $capture_counter = ''; > > } > > } > > > > The bit about the $capture_counter is because some of the files have > > multiple blocks

Re: Unintended behavior: Range operator inside a while loop continues to pattern match on the subsequent file

2011-04-21 Thread Marc Perry
x27;; >>$capture_counter = ''; >>} >> } >> >> The bit about the $capture_counter is because some of the files have >> multiple blocks of text that could be accumulated, and I only want the >> first >> block in the file. >> &g

Re: Unintended behavior: Range operator inside a while loop continues to pattern match on the subsequent file

2011-04-21 Thread Paul Johnson
t; $capture_counter = ''; > } > } > > The bit about the $capture_counter is because some of the files have > multiple blocks of text that could be accumulated, and I only want the first > block in the file. > > This usually works fine, until I encoun

Re: Unintended behavior: Range operator inside a while loop continues to pattern match on the subsequent file

2011-04-21 Thread Brian Fraser
#x27;; >} > } > > The bit about the $capture_counter is because some of the files have > multiple blocks of text that could be accumulated, and I only want the > first > block in the file. > > This usually works fine, until I encountered an input file that did not > c

Unintended behavior: Range operator inside a while loop continues to pattern match on the subsequent file

2011-04-21 Thread Marc Perry
did not contain the string 'labelsub' after the first '' regex pattern match. Then the conditional if test continued to search in the incoming lines in the next file (because I am processing a whole batch using the while (<>) operator), which it eventually found, and then p

RE: suppressing Use of uninitialized value in pattern match (m//)

2009-06-08 Thread Ajay Kumar
d value in pattern match (m//) How can I suppress the first "Use of uninitialized value in pattern match (m//)" warning message. code and output are below. code # cat ./fix_archive.pl #!/usr/bin/perl use warnings; use strict; my @files = <*> unless /.mbox^/; fore

Re: suppressing Use of uninitialized value in pattern match (m//)

2009-05-28 Thread Dr.Ruud
admin2 wrote: How can I suppress the first "Use of uninitialized value in pattern match (m//)" warning message. code and output are below. Don't suppress a message, but fix the problem. my @files = <*> unless /.mbox^/; This is the only pattern match in your script

suppressing Use of uninitialized value in pattern match (m//)

2009-05-28 Thread admin2
How can I suppress the first "Use of uninitialized value in pattern match (m//)" warning message. code and output are below. code # cat ./fix_archive.pl #!/usr/bin/perl use warnings; use strict; my @files = <*> unless /.mbox^/; foreach my $file (@files) {

Re: suppressing Use of uninitialized value in pattern match (m//)

2009-05-27 Thread John W. Krahn
admin2 wrote: How can I suppress the first "Use of uninitialized value in pattern match (m//)" warning message. code and output are below. code # cat ./fix_archive.pl #!/usr/bin/perl use warnings; use strict; my @files = <*> unless /.mbox^/; That line read

suppressing Use of uninitialized value in pattern match (m//)

2009-05-27 Thread admin2
How can I suppress the first "Use of uninitialized value in pattern match (m//)" warning message. code and output are below. code # cat ./fix_archive.pl #!/usr/bin/perl use warnings; use strict; my @files = <*> unless /.mbox^/; foreach my $file (@files) { p

Re: Pattern match question

2009-05-27 Thread Jenda Krynicky
Date sent: Wed, 27 May 2009 16:50:41 +0800 Subject:Pattern match question From: Á÷Ë(R)`Oô To: beginners@perl.org > Hi, All: > > I want to parse data from a HTML page,

Re: Pattern match question

2009-05-27 Thread Alexander Koenig
You wrote on 05/27/2009 10:50 AM: > I want to match one ... pair. > > my code : > > my $pattern = "()"; ... > but I got the whole matches instead of one ... pair each loop. Do need to de-greedify it. my $pattern = "()"; This should do the trick. hth Alex -- To unsubscribe, e-mail: beginner

Pattern match question

2009-05-27 Thread 流水音
Hi, All: I want to parse data from a HTML page, data like: YEMEN YE

RE: Loading results of pattern match into an array - help please

2009-01-24 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: jeffqt...@gmail.com [mailto:jeffqt...@gmail.com] > Sent: Friday, January 23, 2009 12:58 > To: beginners@perl.org > Subject: Loading results of pattern match into an array - help please > > I am trying to split a very long fixed l

Re: Loading results of pattern match into an array - help please

2009-01-23 Thread Owen
> I am trying to split a very long fixed lenght record into its > constituents, and then load them into an array. I have patterns like > '^ > (.{3})(.{24})(.{6})...' which gets teh fields into $1, $2, $3 etc. I > am stumped however as to how to get them into an array in a general > way. With 'use s

Re: Loading results of pattern match into an array - help please

2009-01-23 Thread Gunnar Hjalmarsson
jeffqt...@gmail.com wrote: I am trying to split a very long fixed lenght record into its constituents, and then load them into an array. I have patterns like '^ (.{3})(.{24})(.{6})...' which gets teh fields into $1, $2, $3 etc. my @array = $record =~ /^(.{3})(.{24})(.{6}).../; I havebasic

Re: Loading results of pattern match into an array - help please

2009-01-23 Thread Mr. Shawn H. Corey
On Fri, 2009-01-23 at 11:57 -0800, jeffqt...@gmail.com wrote: > I am trying to split a very long fixed lenght record into its > constituents, and then load them into an array. I have patterns like '^ > (.{3})(.{24})(.{6})...' which gets teh fields into $1, $2, $3 etc. I > am stumped however as to h

Loading results of pattern match into an array - help please

2009-01-23 Thread jeffqtate
I am trying to split a very long fixed lenght record into its constituents, and then load them into an array. I have patterns like '^ (.{3})(.{24})(.{6})...' which gets teh fields into $1, $2, $3 etc. I am stumped however as to how to get them into an array in a general way. With 'use strict' turne

Re: Regex pattern match in perl

2008-12-14 Thread John W. Krahn
explor wrote: Hi Gurus, Hello, I am new to perl and need some help to learn regex in perl. From the below line i need to extract following: Part I 1) $ENVFROM = dapi...@testhost.com 2) $ENVTO1 = te...@etc.com 3) $ENVTO2 = te...@etc.com 4) $ENVTO3 = samt...@abc.com line=EnvFrom: dapi...@tes

Re: Regex pattern match in perl

2008-12-14 Thread Chas. Owens
On Sat, Dec 13, 2008 at 19:35, explor wrote: > Hi Gurus, > I am new to perl and need some help to learn regex in perl. From the > below line i need to extract following: > > Part I > 1) $ENVFROM = dapi...@testhost.com > 2) $ENVTO1 = te...@etc.com > 3) $ENVTO2 = te...@etc.com > 4) $ENVTO3 = samt...

Regex pattern match in perl

2008-12-14 Thread explor
Hi Gurus, I am new to perl and need some help to learn regex in perl. From the below line i need to extract following: Part I 1) $ENVFROM = dapi...@testhost.com 2) $ENVTO1 = te...@etc.com 3) $ENVTO2 = te...@etc.com 4) $ENVTO3 = samt...@abc.com line=EnvFrom: dapi...@testhost.com, HdrTo: , EnvTo:

Net::Telnet "pattern match timed-out..."

2008-09-17 Thread ariel . casas
Hello all, I am trying to automate a simple telnet to port 7010 and give me the output to the command "gstatus". However, I get the following error: ./telnet_mod.test.pl pattern match timed-out at ./telnet_mod.test.pl line 6 Here are the contents of

Re: Uninitialized value in pattern match

2008-03-31 Thread Rob Dixon
Johan wrote: > > The last line of this code > foreach $PkgFile( @$PkgList ) > { > if( $PkgFile =~m/^\s*$/) > > gives this warning message > Use of uninitialized value in pattern match (m//) at packagefile.pm > line 838. > > How can I solve this? (

Re: Uninitialized value in pattern match

2008-03-31 Thread Rob Coops
> > gives this warning message > Use of uninitialized value in pattern match (m//) at packagefile.pm > line 838. > > How can I solve this? (I have no idea what the code does...) > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > >

Uninitialized value in pattern match

2008-03-31 Thread Johan
The last line of this code foreach $PkgFile( @$PkgList ) { if( $PkgFile =~m/^\s*$/) gives this warning message Use of uninitialized value in pattern match (m//) at packagefile.pm line 838. How can I solve this? (I have no idea what the code does...) -- To unsubscribe, e-mail: [EMAIL

Re: Use of uninitialized value in pattern match (m//)

2007-12-05 Thread Ankur Jain
he following code and receiving the warning : > > > > Use of uninitialized value in pattern match (m//) at a.pl line 15. > > > > > > a.pl : > > / > > > **/ > &g

Re: Use of uninitialized value in pattern match (m//)

2007-12-04 Thread [EMAIL PROTECTED]
On Dec 4, 2:47 pm, [EMAIL PROTECTED] (Rob Dixon) wrote: > [EMAIL PROTECTED] wrote: > >my ($n,$d) = split /\./, shift, 2; > > which specifies the field count in two ways: the third parameter says > that the string should be split into (a maximum of) two parts. and even > if that wasn't there the

Re: Use of uninitialized value in pattern match (m//)

2007-12-04 Thread [EMAIL PROTECTED]
On Dec 4, 2:47 pm, [EMAIL PROTECTED] (Rob Dixon) wrote: > [EMAIL PROTECTED] wrote: > > As it happens, even if there was a '.' as the last character in your > > input string then you'd still get the same message. This is counter- > > intuitive but is documented in the documentation of the split() >

Re: Use of uninitialized value in pattern match (m//)

2007-12-04 Thread Rob Dixon
Ankur wrote: I am running the following code and receiving the warning : Use of uninitialized value in pattern match (m//) at a.pl line 15. a.pl : / **/ sub CommaFormatted{ my $delimiter

Re: Use of uninitialized value in pattern match (m//)

2007-12-04 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > On Dec 4, 7:25 am, [EMAIL PROTECTED] (Ankur) wrote: I am running the following code and receiving the warning : Use of uninitialized value in pattern match (m//) at a.pl line 15. That is to be expected. a

Re: Use of uninitialized value in pattern match (m//)

2007-12-04 Thread [EMAIL PROTECTED]
On Dec 4, 7:25 am, [EMAIL PROTECTED] (Ankur) wrote: > Hi > > I am running the following code and receiving the warning : > > Use of uninitialized value in pattern match (m//) at a.pl line 15. That is to be ex

Use of uninitialized value in pattern match (m//)

2007-12-04 Thread Ankur
Hi I am running the following code and receiving the warning : Use of uninitialized value in pattern match (m//) at a.pl line 15. a.pl : / **/ sub CommaFormatted{ my $delimiter = ','; # replac

Re: [Correction] Re: pattern match

2007-02-12 Thread Mumia W.
On 02/12/2007 04:17 PM, D. Bolliger wrote: D. Bolliger am Montag, 12. Februar 2007 23:03: Mumia W. am Montag, 12. Februar 2007 21:53: On 02/12/2007 02:33 PM, Vladimir Lemberg wrote: [snipped] Mumia, please excuse me for my inappropriate correction! [...] No problem. I'm glad I tested it be

[Correction] Re: pattern match

2007-02-12 Thread D. Bolliger
D. Bolliger am Montag, 12. Februar 2007 23:03: > Mumia W. am Montag, 12. Februar 2007 21:53: > > On 02/12/2007 02:33 PM, Vladimir Lemberg wrote: [snipped] Mumia, please excuse me for my inappropriate correction! > > You probably want to push the filename onto the array if you get a > > successfu

Re: pattern match

2007-02-12 Thread D. Bolliger
Mumia W. am Montag, 12. Februar 2007 21:53: > On 02/12/2007 02:33 PM, Vladimir Lemberg wrote: > > Hi, > > > > I have a script, which suppose to find all *.xml files under the > > specified directory then process them. I'm facing the pattern match > > problem

Re: pattern match

2007-02-12 Thread Mumia W.
On 02/12/2007 02:33 PM, Vladimir Lemberg wrote: Hi, I have a script, which suppose to find all *.xml files under the specified directory then process them. I'm facing the pattern match problem: use strict; use warnings; use Win32; use File::Find; @ARGV = Win32::GetCwd() unless @ARGV;

Re: pattern match

2007-02-12 Thread John W. Krahn
Vladimir Lemberg wrote: > Hi, Hello, > I have a script, which suppose to find all *.xml files under the specified > directory then process them. I'm facing the pattern match problem: > > use strict; > use warnings; > use Win32; > use File::Find; > > @ARGV =

Re: pattern match

2007-02-12 Thread D. Bolliger
Vladimir Lemberg am Montag, 12. Februar 2007 21:33: > Hi, Hi Vladimir (in addition to Davids post) > I have a script, which suppose to find all *.xml files under the specified > directory then process them. I'm facing the pattern match problem: > > use strict; > use warni

Re: pattern match

2007-02-12 Thread Vladimir Lemberg
David, Thanks you very much! It works -) - Original Message - From: "Wagner, David --- Senior Programmer Analyst --- WGO" <[EMAIL PROTECTED]> To: "Vladimir Lemberg" <[EMAIL PROTECTED]>; Sent: Monday, February 12, 2007 12:46 PM Subject: RE: pattern

RE: pattern match

2007-02-12 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: Vladimir Lemberg [mailto:[EMAIL PROTECTED] > Sent: Monday, February 12, 2007 12:33 > To: beginners@perl.org > Subject: pattern match > > Hi, > > I have a script, which suppose to find all *.xml files under > the specified dire

pattern match

2007-02-12 Thread Vladimir Lemberg
Hi, I have a script, which suppose to find all *.xml files under the specified directory then process them. I'm facing the pattern match problem: use strict; use warnings; use Win32; use File::Find; @ARGV = Win32::GetCwd() unless @ARGV; my @dirs; find (\&FindXml, $ARGV[0]); su

Re: pattern match

2006-07-13 Thread Dr.Ruud
Ken Foskey schreef: > open(LYNX,"|-","lynx -source http://www.perl.com/";) or die("Can't open > lynx: $!"); #!/usr/bin/perl use warnings ; use strict ; my $cmd = 'lynx -source http://www.perl.com/' ; open my $ph, '-|', $cmd or die "\nError opening '$cmd', stopped $!" ; while ( <

RE: pattern match

2006-07-13 Thread Ken Foskey
On Tue, 2006-07-11 at 18:48 -0700, Timothy Johnson wrote: > open(LYNX,"<","lynx -source http://www.perl.com/ |") or die("Can't open > lynx: $!"); I am not sure that this is right. open(LYNX,"|-","lynx -source http://www.perl.com/";) or die("Can't open lynx: $!"); I think this is. Ta Ken --

Re: pattern match

2006-07-12 Thread Rob Dixon
Ryan Dillinger wrote: > > Hello, Hi Ryan > I had two scripts that were identical, well almost. I ran the two together, > but straghtened them out. Anyway I have one here, that when ran say's: Use of > uninitialized value in pattern match (m//) at headline.pl line 7 and 1

Re: pattern match

2006-07-11 Thread Mumia W.
Ryan Dillinger wrote: > [...] > #!/usr/bin/perl > use warnings; > use strict; > > open LYNX, "lynx -source http://www.perl.com/ |" or die "Can't open lynx: > $!"; > $_ = ""; > $_ = until /standard\.def/; > If 'standard.def' is not found, this line loops forever. > my $head = ; > $head =~ m|^]

Re: pattern match

2006-07-11 Thread Mr. Shawn H. Corey
Ryan Dillinger wrote: > Hello, > I had two scripts that were identical, well almost. I ran the two > together, but > straghtened them out. Anyway I have one here, that when ran say's: Use > of uninitialized > value in pattern match (m//) at headline.pl line 7 and 10. I ha

Re: pattern match

2006-07-11 Thread Mr. Shawn H. Corey
Ryan Dillinger wrote: > Hello, > I had two scripts that were identical, well almost. I ran the two > together, but > straghtened them out. Anyway I have one here, that when ran say's: Use > of uninitialized > value in pattern match (m//) at headline.pl line 7 and 10. I ha

RE: pattern match

2006-07-11 Thread Timothy Johnson
-Original Message- From: Ryan Dillinger [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 6:28 PM To: beginners@perl.org Subject: pattern match Use of uninitialized value in pattern match (m//) at headline.pl line 7 and 10. #!/usr/bin/perl use warnings; use strict; open

pattern match

2006-07-11 Thread Ryan Dillinger
Hello, I had two scripts that were identical, well almost. I ran the two together, but straghtened them out. Anyway I have one here, that when ran say's: Use of uninitialized value in pattern match (m//) at headline.pl line 7 and 10. I have changed differernt things within, nothing worke

Re: including . in a pattern match

2006-01-30 Thread Chas Owens
On 1/30/06, Keith Worthington <[EMAIL PROTECTED]> wrote: snip > > This may motivate me to hack on that module to add -unsigned and > > -negative options. > > Obviously that would benefit someone in my situation that really doesn't want > to > allow negative numbers. I think that hacking a module

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
On Mon, 30 Jan 2006 13:26:42 -0500, Chas Owens wrote > On 1/30/06, Keith Worthington <[EMAIL PROTECTED]> wrote: > snip > > Well, the answer was right in fromt of me. The delimiter pattern is > > matching the first hyphen and the integer pattern is matching the > > second hyphen as a negative sig

Re: including . in a pattern match

2006-01-30 Thread Chas Owens
On 1/30/06, Keith Worthington <[EMAIL PROTECTED]> wrote: snip > Well, the answer was right in fromt of me. The delimiter pattern is mattching > the first hyphen and the integer pattern is matching the second hyphen as a > negative sign. Arrrgh! > > The Regex::Dommon::Number documentation doesn't

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
snip > > The only challenge is that the $p_number pattern seems to match all of > the following. 10 1/2 10-1/2 10--1/2 > > I started out with (\s+|-?) as my delimiter pattern and then when that > didn't work I changed it to (\s+|-{1,1}). It still matches the case > with two hyphens. Can you t

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
On Mon, 30 Jan 2006 10:26:51 -0500, Chas Owens wrote > On 1/30/06, Keith Worthington <[EMAIL PROTECTED]> wrote: > snip > > Wow, it is going to take me some time to wrap my head around this > > code. I really like the commenting idea. That certainly will > > help the next time around. I don't g

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
On Mon, 30 Jan 2006 10:26:51 -0500, Chas Owens wrote > On 1/30/06, Keith Worthington <[EMAIL PROTECTED]> wrote: > snip > > Wow, it is going to take me some time to wrap my head around > > this code. I really like the commenting idea. That certainly > > will help the next time around. I don't g

Re: including . in a pattern match

2006-01-30 Thread Chas Owens
On 1/30/06, Keith Worthington <[EMAIL PROTECTED]> wrote: snip > Wow, it is going to take me some time to wrap my head around this code. I > really like the commenting idea. That certainly will help the next time > around. > I don't get the lines where you defined the pattern. > i.e. my $border

Re: including . in a pattern match

2006-01-30 Thread Keith Worthington
On Fri, 27 Jan 2006 18:31:18 -0500, Chas Owens wrote > Another thing you can do is break your larger regexes into parts to > make them more readable/maintainable. It also helps to use the x flag > so that you can separate the individual tokens and comment them. > > #!/usr/bin/perl > > use strict

Re: including . in a pattern match

2006-01-27 Thread Chas Owens
> my $match=qr{#match the whole record for a widget > ^#start of the record > $border #a border value > \s* #optional spaces > $size#a size value > \s* #optional spaces > $tag #a tag value > $#optional sp

Re: including . in a pattern match

2006-01-27 Thread Chas Owens
Another thing you can do is break your larger regexes into parts to make them more readable/maintainable. It also helps to use the x flag so that you can separate the individual tokens and comment them. #!/usr/bin/perl use strict; use warnings; use Regexp::Common; #FIXME: the border value shou

Re: including . in a pattern match

2006-01-27 Thread Chas Owens
On 1/27/06, Keith Worthington <[EMAIL PROTECTED]> wrote: snip > I have tried a couple of things but I am struggling with how to optionally > match the decimal point. > > I think what I need is the code equivilant of: >zero or more numbers followed by >zero or one decimal point followed by

including . in a pattern match

2006-01-27 Thread Keith Worthington
Hi All, I am still a newbie in Perl and it is only with the help of this list that I was able to construct the following pattern match. ($v_size_str =~ /\d+\s*['"]\s*x\s*\d+\s*['"]/i) The problem that I have just realized that this string will match the first line of thi

Re: Use of uninitialized value in pattern match ..., <> chunk 2

2005-02-23 Thread John W. Krahn
mark McWilliams wrote: What is the following telling me , especially the chunk 2? Use of uninitialized value in pattern match (m//) at ./lo line 27, <> chunk 2 That means that the variable that is bound to the pattern match contains the value undef. "chunk 2" means that you are c

Use of uninitialized value in pattern match ..., <> chunk 2

2005-02-23 Thread mark McWilliams
What is the following telling me , especially the chunk 2? Use of uninitialized value in pattern match (m//) at ./lo line 27, <> chunk 2 I used if (defined ... to get rid of a few other errors. this is in reference to the following code edited to reduce size while (defined($in = <>

RE: Use of uninitialized value in pattern match (m//)

2005-02-13 Thread Charles K. Clarkson
mark McWilliams <mailto:[EMAIL PROTECTED]> wrote: mark McWilliams <[EMAIL PROTECTED]> wrote: : I do not know how to get rid of this error : Use of uninitialized value in pattern match (m//) : : Use of uninitialized value in pattern match (m//) at : ./2new.pl line 97, <> line

Use of uninitialized value in pattern match (m//)

2005-02-13 Thread mark McWilliams
I do not know how to get rid of this error Use of uninitialized value in pattern match (m//) This is were the error is if ( defined $modem{$Ascend_Xmit_Rate} =~ /\d/) { print " __\t modem{Ascend_X_Rate}_\t __\n";

Re: Pattern match

2004-06-22 Thread John W. Krahn
Naser Ali wrote: > > Naser Ali wrote: > > > >I have an array which was created by slurrping a whole text file. There > >are certain element in the array after reading the files which contain > >only one word. I want to only match those array elements which contain > >a single word and print it. Tr

Re: Pattern match

2004-06-22 Thread Gunnar Hjalmarsson
Naser Ali wrote: It works, What is it that works? The data pattern looks like this; Aword Yep, that's one word. Aword Anotherword That's two words. None of the posted suggestions matches that line. You said in your original post: "I want to only match those array elements which contain a single wo

RE: Pattern match

2004-06-22 Thread Naser Ali
- From: Roberto Etcheverry [mailto:[EMAIL PROTECTED] Sent: Monday, June 21, 2004 5:44 PM To: Naser Ali Cc: [EMAIL PROTECTED] Subject: Re: Pattern match It's difficult to answer if you do not post the code with some input to test it, but lets suppose you have this: my @array; @array = ;

Re: Pattern match

2004-06-21 Thread Chris Charley
- Original Message - From: "Naser Ali" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: <[EMAIL PROTECTED]> Sent: Monday, June 21, 2004 3:52 PM Subject: Pattern match > Hello, > > I have an array which was created by slurrping a whole text file. The

Re: Pattern match

2004-06-21 Thread Roberto Etcheverry
It's difficult to answer if you do not post the code with some input to test it, but lets suppose you have this: my @array; @array = ; # slurp whole file Then is easy to get what you want: my @lines_with_single_word = grep /^\s*\S+\s*$/,array; # ^\s*\S+\s*$ means beginning of line, 0 or more wh

Re: Pattern match

2004-06-21 Thread Gunnar Hjalmarsson
Naser Ali wrote: I have an array which was created by slurrping a whole text file. There are certain element in the array after reading the files which contain only one word. I want to only match those array elements which contain a single word and print it. You need to anchor the word to both the

Pattern match

2004-06-21 Thread Naser Ali
Hello, I have an array which was created by slurrping a whole text file. There are certain element in the array after reading the files which contain only one word. I want to only match those array elements which contain a single word and print it. Tried every thing but in vain. I must be doing s

Re: pattern match question

2004-05-05 Thread Jose Alves de Castro
/(?<=Retrieval command for )http:.*?:/){ > > It prints off the "Retrieval command for" part as it did before :( > > > any ideas? > > > Cheers, > > Graeme :) > > > > >From: Jose Alves de Castro <[EMAIL PROTECTED]> > >To: Gr

Re: pattern match question

2004-05-05 Thread Graeme McLaren
ROTECTED]> To: Graeme McLaren <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: pattern match question Date: 05 May 2004 11:09:19 +0100 MIME-Version: 1.0 Received: from onion.perl.org ([63.251.223.166]) by mc5-f36.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Wed, 5 May 2004 03:13:0

Re: pattern match question

2004-05-05 Thread Jose Alves de Castro
I would do /(?<=Retrieval command for )http:.*?:/ The "Retrieval" part now is contained in a "Look behind section", which is to mean it's not going to be stored as part of the match. I'm not sure what other cases you can get in that log file, but this solves the problem for that particular line

pattern match question

2004-05-05 Thread Graeme McLaren
Hi, I'm trying to build a regular expression. to match a URL from a logfile. In the logfile an example of the pattern I'm trying to match is: 12:12:1:http://10.2.203.1/missing1.html: Retrieval command for http://10.2.203.1/missing1.html: GET /missing1.html HTTP/1.0 so far I've got: =~ /^.*?Ret

Re: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-14 Thread Owen
On Sat, 13 Dec 2003 18:12:17 +0100 Jerry Rocteur <[EMAIL PROTECTED]> wrote: > I'm trying to be a good boy and use strict and warnings .. > > The more I do, the more I feel I'm wasting so much time and should > become productive, my code looks full of 'my' Because so many people in c.l.p.m said

RE: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-14 Thread Bakken, Luke
> uninitialized value in > pattern match (m//) at ./getopt.pl line 14.' Use the standard Getopt::Std module to process options. Don't do it yourself. > Line 14 is the while line.. > > I've tried all sorts of stuff with defined but keep getting syntax > errors

Re: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-14 Thread Jerry Rocteur
ttle routing gives me 'Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.' Line 14 is the while line.. I've tried all sorts of stuff with defined but keep getting syntax errors. I've tried perldoc warnings and perldoc perllexwarn .. In any case, unl

Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-14 Thread Jerry Rocteur
lies. My DBI Perl is even more of a headache ;-(( Anyway, enough whining, now I've going through code that is working and thought I'd see the big difference if I change it to use warnings and strict and this little routing gives me 'Use of uninitialized value in pattern match (

Re: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-13 Thread drieux
On Dec 13, 2003, at 10:01 AM, Wiggins d'Anconia wrote: [.. A decent template, any gurus have improvements? [..] my stock gag, looks like: my $opt = parse_cmd_line_options(); ... #--- # These are the Subs for the parse_cmd_line_options. #

Re: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-13 Thread R. Joseph Newton
Wiggins d'Anconia wrote: > More code showing specifically why I have been rambling about $_ in the > last couple of days. If you are going to shift off the argument list > why not just do it in the while loop when you are setting $_? Thanks, Wiggins, and keep on rambling. The point needs reiter

Re: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-13 Thread Rob Dixon
ing and > thought I'd see the big difference if I change it to use warnings and > strict and this little routing gives me 'Use of uninitialized value in > pattern match (m//) at ./getopt.pl line 14.' > > Line 14 is the while line.. 'use warnings' will moan at

Re: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-13 Thread Wiggins d'Anconia
er coding in Perl for 3+ years... Anyway, enough whining, now I've going through code that is working and thought I'd see the big difference if I change it to use warnings and strict and this little routing gives me 'Use of uninitialized value in pattern match (m//) at ./getopt

Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-13 Thread Jerry Rocteur
lies. My DBI Perl is even more of a headache ;-(( Anyway, enough whining, now I've going through code that is working and thought I'd see the big difference if I change it to use warnings and strict and this little routing gives me 'Use of uninitialized value in pattern match (

Re: Pattern Match

2003-12-12 Thread Rob Dixon
Robert Brown wrote: > > R. Joseph Newton writes: > > When used consciously, with at least a general awareness of the processing > > load being invoked, regexes can do some really incredible things. > > Thanks! I especially appreciate the example you gave showing how to > trim both ends of a stri

  1   2   >