Re: regexp inside hashes

2006-10-03 Thread John W. Krahn
Michael Alipio wrote: > Hi, Hello, [ snip ] > Now, my goal is to adapt that code, particularly > obtaining only Start, IP, User. However, those three > targets are not anymore located at the beginning of a > line. > > "Start" is the date=.time= combination, > "IP" is found after rem_ip= > "User

regexp inside hashes

2006-10-03 Thread Michael Alipio
Hi, There was this example given to me: while ( ) { my %extr = ( Start => '', IP=> '', User => '', End => '', /^(Start|IP|User|End)=(.+)/mg ); print "Start:$extr{Start} IP:$extr{IP} User:$extr{User} End:$extr{End}\n\n"; } Readin

Re: Smart assignment

2006-10-03 Thread Mumia W.
On 10/03/2006 11:37 AM, Derek B. Smith wrote: returns "true" or "false" (1 or '') and in list context it returns the contents of any capturing parentheses in the pattern. The expression: ( $ptypeline =~ /movable.+(sine|geo|radial|ortho)/i )[ 0 ] is a list slice so the regular expression is in

Re: Smart assignment

2006-10-03 Thread Igor Sutton
Umm... So would this do what I want also? ($ptype)=($projection =~ /movable.+(sine|geo|radial|ortho)/i) or $ptype="(missing)"; I think the correct is: $ptype = ($projection =~ /movable.+(sine|geo|radial|ortho)/i) || "(missing)"; '||' will be tight with ( $projection =~ ... )

Re: Smart assignment

2006-10-03 Thread Bryan R Harris
> Bryan R Harris wrote: >> returns "true" or "false" (1 or '') and in list context it returns the contents of any capturing parentheses in the pattern. The expression: ( $ptypeline =~ /movable.+(sine|geo|radial|ortho)/i )[ 0 ] is a list slice so the

Re: Smart assignment

2006-10-03 Thread John W. Krahn
Bryan R Harris wrote: > >>>returns "true" or "false" (1 or '') and in list context it returns the >>>contents of any capturing parentheses in the pattern. >>> >>>The expression: >>> >>>( $ptypeline =~ /movable.+(sine|geo|radial|ortho)/i >>>)[ 0 ] >>> >>>is a list slice so the regular expression is

Re: Smart assignment

2006-10-03 Thread Bryan R Harris
>> returns "true" or "false" (1 or '') and in list context it returns the >> contents of any capturing parentheses in the pattern. >> >> The expression: >> >> ( $ptypeline =~ /movable.+(sine|geo|radial|ortho)/i >> )[ 0 ] >> >> is a list slice so the regular expression is in list context but th

Re: Smart assignment

2006-10-03 Thread Derek B. Smith
> returns "true" or "false" (1 or '') and in list > context it returns the > contents of any capturing parentheses in the > pattern. > > The expression: > > ( $ptypeline =~ /movable.+(sine|geo|radial|ortho)/i > )[ 0 ] > > is a list slice so the regular expression is in list > context but the sl

Re: Smart assignment

2006-10-03 Thread Bryan R Harris
> Jen Spinney wrote: >> On 10/2/06, Mumia W. <[EMAIL PROTECTED]> wrote: >>> >>> Yes, and here is another way: >>> >>> $ptype = (($ptypeline =~ /movable.+(sine|geo|radial|ortho)/i)[0]) || >>> '(missing)'; >> >> How does that way work? I was curious, so I tested it myself and it >> clearly did

Imlib2 Module install failure problem

2006-10-03 Thread Raphael Brunner
Dear Users I work on debian testing with perl 5.8.8. If I try to install the module Image::Imlib2 to install (perl -MCPAN -e shell / install Image::Imlib2) then after a few downloads, I see this error-message: -- snip -- Warning: this distribution contains XS files, but Module::Build is not conf

Re: IO::Scalar Help

2006-10-03 Thread Rob Dixon
Michael Alipio wrote: > > My Log file looks like this: > Each session contains at most four lines and then it > is separated by newline. I need to grab each session > and put each key/value pair in hash. > > > Start=2006-10-03.09:09:51 > IP=192.168.0.14 > User=alex > End=2006-10-03.09:14:10 > > St

Re: Regexp Basics

2006-10-03 Thread Sijo George
Else try This.. #!/usr/local/bin/perl use strict; my $string = "Theres more than 1 way to do it"; if ($string =~ /\w+$/){ print "Hooray! pattern found\n"; print $&; } Use the inbuilt perl variables.. $` prints the pre matching part, $& gives the matched variale and $' gives the post matching pa

Re: IO::Scalar Help

2006-10-03 Thread John W. Krahn
Michael Alipio wrote: > > My Log file looks like this: > Each session contains at most four lines and then it > is separated by newline. I need to grab each session > and put each key/value pair in hash. > > > Start=2006-10-03.09:09:51 > IP=192.168.0.14 > User=alex > End=2006-10-03.09:14:10 > >

RE: GD::Graph and integer on the Y-axis

2006-10-03 Thread john
Hi I used the formula $Y_max=(int($Y_max/8)+2)/8; And it worked, so the Y_max is higher than the actual Y_max of the dataset -Original Message- From: Greg Sabino Mullane [mailto:[EMAIL PROTECTED] Sent: Monday, October 02, 2006 8:08 PM To: john Cc: beginners@perl.org Subject: Re: GD::

IO::Scalar Help

2006-10-03 Thread Michael Alipio
My Log file looks like this: Each session contains at most four lines and then it is separated by newline. I need to grab each session and put each key/value pair in hash. Start=2006-10-03.09:09:51 IP=192.168.0.14 User=alex End=2006-10-03.09:14:10 Start=2006-10-03.09:52:12 IP=192.168.0.15 End=