RE: perl almost an adult? [was: s/// w/o RE]

2004-04-15 Thread Charles K. Clarkson
Bryan Harris [mailto:[EMAIL PROTECTED] : : So when was perl born? The only date I can find is 1986, : which means perl's : almost 18... DO you really think that would be in the documentation? Read 'perlhist': . . . THE RECORDS Pump-

Re: perl almost an adult? [was: s/// w/o RE]

2004-04-15 Thread Randy W. Sims
On 4/16/2004 12:16 AM, Bryan Harris wrote: Wiggins> So do I after 7 years ;-)... And I after twice that. Hey, perl hasn't been around for quite 21 years! err, my math must be rusty: twice 7 years != 21 Oops, sorry, my undiagnosed dyslexia is acting up -- I read it three times, and each time it

perl almost an adult? [was: s/// w/o RE]

2004-04-15 Thread Bryan Harris
>>> Wiggins> So do I after 7 years ;-)... >>> >>> And I after twice that. >> >> Hey, perl hasn't been around for quite 21 years! > > err, my math must be rusty: twice 7 years != 21 Oops, sorry, my undiagnosed dyslexia is acting up -- I read it three times, and each time it said "And I twice a

Re: why $a became 6 ?

2004-04-15 Thread John W . Krahn
On Thursday 15 April 2004 20:38, Randy W. Sims wrote: > > On 4/15/2004 11:24 PM, John W. Krahn wrote: > > > > On Thursday 15 April 2004 11:41, John W. Krahn wrote: > >> > >>On Thursday 15 April 2004 11:22, Jayakumar Rajagopal wrote: > >>> > >>>$a=100; $b=200; > >>>($a=3 && $b=6 ) if ( 1 == 1 ); > >

Re: s/// w/o RE

2004-04-15 Thread Randy W. Sims
On 4/15/2004 11:56 PM, Bryan Harris wrote: Wiggins> So do I after 7 years ;-)... And I after twice that. Hey, perl hasn't been around for quite 21 years! err, my math must be rusty: twice 7 years != 21 Randy. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EM

Re: s/// w/o RE

2004-04-15 Thread Bryan Harris
> Wiggins> So do I after 7 years ;-)... > > And I after twice that. Hey, perl hasn't been around for quite 21 years! - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: why $a became 6 ?

2004-04-15 Thread Randy W. Sims
On 4/15/2004 11:24 PM, John W. Krahn wrote: On Thursday 15 April 2004 11:41, John W. Krahn wrote: On Thursday 15 April 2004 11:22, Jayakumar Rajagopal wrote: $a=100; $b=200; ($a=3 && $b=6 ) if ( 1 == 1 ); print " $a $b \n"; Output : 6 6 OR my syntax is wrong ? You have a precedence problem

Re: why $a became 6 ?

2004-04-15 Thread John W . Krahn
On Thursday 15 April 2004 11:41, John W. Krahn wrote: > > On Thursday 15 April 2004 11:22, Jayakumar Rajagopal wrote: > > > > $a=100; $b=200; > > ($a=3 && $b=6 ) if ( 1 == 1 ); > > print " $a $b \n"; > > > > Output : 6 6 > > > > OR my syntax is wrong ? > > You have a precedence problem. Your

Re: Simple regex

2004-04-15 Thread Randy W. Sims
On 4/15/2004 7:10 PM, [EMAIL PROTECTED] wrote: How can I write a regular expression to keep the part of a string that's between a pair of square braces? Here's a sample line: Updating Wellbore Set Keys: [wlbr_id = 1234567890, data_provider_code = MTBL, welltype = OIL] use Text::Balanced; # includ

AW: Regex to match domain for cookie

2004-04-15 Thread B. Fongo
Hi Rob! Your example using split is a bit too long. The regex worked fine. Can you help me understand what you did here? Say we have www.domain4you.co.uk or https://rrp.domain-house.com So we substitute any character from start to the one before the first dot with nothing, right? In the case o

RE: Regex to match domain for cookie

2004-04-15 Thread Hanson, Rob
It might be easier to do it with a split. # untested foreach (@domains) { my @parts = split(/\./, $_); my $name; if (@parts > 1) { shift @parts; $name = '.' . join('.', @parts); } print $name; } As a regex, this I think will work... foreach (@domains) { my $name = $_;

Re: Simple regex

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 6:22 PM, James Edward Gray II wrote: On Apr 15, 2004, at 6:10 PM, [EMAIL PROTECTED] wrote: How can I write a regular expression to keep the part of a string that's between a pair of square braces? Here's a sample line: Updating Wellbore Set Keys: [wlbr_id = 1234567890, data

Regex to match domain for cookie

2004-04-15 Thread B. Fongo
How do I match a domain name starting from the dot? # Match something like these ".domain4you.co.uk" ".domain-house.de" This is what I have: @domains = ("http://www.domain.com ", "http://www.domain4you.co.uk "http://www.domain-house.de"; "https//rrp.cash-day.com" ); f

Re: Simple regex

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 6:10 PM, [EMAIL PROTECTED] wrote: How can I write a regular expression to keep the part of a string that's between a pair of square braces? Here's a sample line: Updating Wellbore Set Keys: [wlbr_id = 1234567890, data_provider_code = MTBL, welltype = OIL] Maybe: s/^[^[]]*\[

Re: Simple regex

2004-04-15 Thread WilliamGunther
In a message dated 4/15/2004 7:13:09 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: >How can I write a regular expression to keep the part of a string that's >between a pair of square braces? Here's a sample line: > >Updating Wellbore Set Keys: [wlbr_id = 1234567890, data_provider_code = >MT

RE: Simple regex

2004-04-15 Thread Hanson, Rob
Try this... # untested $text =~ s/\[[^\]]+?\]/$1/g; [^\]] - means anything but a closing bracket +? - means 1 or more times (as few as possible) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 7:11 PM To: [EMAIL PROTECTED] Subject:

Re: Flag for script

2004-04-15 Thread JupiterHost.Net
Jakob Kofoed wrote: Hello All, I'm trying to create a script with where you can put a flag to the script or not fx run it like: script -h or just script something like: if ( $ARGV[0] =~ /-h/ ) { Try if(defined $ARGV[0]) { if($ARGV[0] eq '-h') { print "Welcome to dash h\n"; } else { print

Simple regex

2004-04-15 Thread scott . e . robinson
How can I write a regular expression to keep the part of a string that's between a pair of square braces? Here's a sample line: Updating Wellbore Set Keys: [wlbr_id = 1234567890, data_provider_code = MTBL, welltype = OIL] Thanks in advance for your help! Scott Scott E. Robinson SWAT Team Data

RE: Making a linker/preassembler

2004-04-15 Thread Hanson, Rob
I don't know much about asm, but maybe this will help a little. A s/// should work, and as the replacement value it can call a function to do the work. # untested $code = handle_includes($code); sub handle_includes { my $code = shift; $code = s/^\s*include\s+([\w\.]+)/include_file($1)/eg; r

RE: Help with Variable Scope, Regular Expressions

2004-04-15 Thread Charles K. Clarkson
William Martell <[EMAIL PROTECTED]> wrote: : : Hi Charles. Thank you very much for the code and the lesson. : Works perfectly! It wasn't meant to be a finished product. Just an example to learn from. You need to, at least, add some error checking, but I am glad it works. :) : I am trying t

RE: Flag for script

2004-04-15 Thread Jakob Kofoed
Thanks for all your replies - I have something to work with! Cheers, Jakob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

RE: Flag for script

2004-04-15 Thread Guay Jean-Sébastien
Hello Jakob, > I'm trying to create a script with where you can put a flag to the script or > not > fx run it like: > > script -h > or just > script I would use one of the Getopt::* modules, because parsing command line options is something very standard, and as you add more and more options, th

Re: Flag for script

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 2:10 PM, Jakob Kofoed wrote: Hello All, I'm trying to create a script with where you can put a flag to the script or not fx run it like: script -h or just script something like: if ( $ARGV[0] =~ /-h/ ) { print "You have chosen the very special ability!\n"; } else { print "y

Making a linker/preassembler

2004-04-15 Thread Lolbassett
Hi, I'm planning to make a kind of linker/preassembler for making ROM source files from multiple header and ASM files. What sort of regular expression and algoriths could I use to search for things like "include Name.dat", etc? Thanks, Lewis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Flag for script

2004-04-15 Thread WilliamGunther
In a message dated 4/15/2004 3:19:04 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: >I'm trying to create a script with where you can put a flag to the script or >not >fx run it like: [Rest snipped] It's best not to deal with @ARGV directly if you want to do the fancy stuff. Look into Getop

Flag for script

2004-04-15 Thread Jakob Kofoed
Hello All, I'm trying to create a script with where you can put a flag to the script or not fx run it like: script -h or just script something like: if ( $ARGV[0] =~ /-h/ ) { print "You have chosen the very special ability!\n"; } else { print "you have not chosen the very special ability!\n"; }

RE: why $a became 6 ?

2004-04-15 Thread Bob Showalter
John W. Krahn wrote: > Or: > > ( $a = 3 and $b = 6 ) if ( 1 == 1 ); or if he intends both assignments to be made together: $a = 3, $b = 6 if 1 == 1; This will set $b to 6 even if $a is set to a false value, which the prior methods won't do. This may or may not be what the OP is after... --

Re: "\s" eq "\b" ?

2004-04-15 Thread Jenda Krynicky
From: "Rob Dixon" <[EMAIL PROTECTED]> > Jenda Krynicky wrote: > > > > From: "Jayakumar Rajagopal" <[EMAIL PROTECTED]> > > > hi friends, > > > in regexp, I feel \s and \b behaves same. > > > can someone send me a contradiction ? > > > > $str = "This is a sentence. And this is another."; > > > > @all

RE: why $a became 6 ?

2004-04-15 Thread Jayakumar Rajagopal
Thank you Steve,William,Ricardo. Excellent answers. regards, Jay -Original Message- From: Steve Grazzini [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 2:43 PM To: Jayakumar Rajagopal Cc: [EMAIL PROTECTED] Subject: Re: why $a became 6 ? Jayakumar Rajagopal wrote: > ($a=3 && $b

Re: why $a became 6 ?

2004-04-15 Thread Steve Grazzini
Jayakumar Rajagopal wrote: ($a=3 && $b=6 ) if ( 1 == 1 ); print " $a $b \n"; Output : 6 6 This is a precedence problem; the "&&" binds more tightly than the "=" on its left. B::Deparse eliminates some of the constant expressions, but you can see the result: % perl -MO=Deparse,-p -e '$a=

RE: guessing script

2004-04-15 Thread Guay Jean-Sébastien
Hello Greg, > Thanks for you comments. Is this the best way then? Seems to work, but I'm > curious what could be any better.. Your version is fine. Here's mine, just so you have another take on how to do some things. Among a few other things, I added checking for so that the guess has to be a

Re: why $a became 6 ?

2004-04-15 Thread John W . Krahn
On Thursday 15 April 2004 11:22, Jayakumar Rajagopal wrote: > > $a=100; $b=200; > ($a=3 && $b=6 ) if ( 1 == 1 ); > print " $a $b \n"; > > Output : 6 6 > > OR my syntax is wrong ? You have a precedence problem. Your expression evaluates as: $ perl -MO=Deparse,-p -e'($a=3 && $b=6 ) if ( 1 ==

Re: why $a became 6 ?

2004-04-15 Thread WilliamGunther
In a message dated 4/15/2004 2:25:14 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: >$a=100; $b=200; >($a=3 && $b=6 ) if ( 1 == 1 ); >print " $a $b \n"; > >Output : 6 6 > >OR my syntax is wrong ? && binds pretty tight. If it helps to see the parenthesis here is what you said: ($a =

Re: why $a became 6 ?

2004-04-15 Thread Ricardo SIGNES
* Jayakumar Rajagopal <[EMAIL PROTECTED]> [2004-04-15T14:22:08] > $a=100; $b=200; > ($a=3 && $b=6 ) if ( 1 == 1 ); > print " $a $b \n"; > > Output : 6 6 > > OR my syntax is wrong ? > regards, > Jay Your understanding of precedence is wrong. You've effectively said this: ($a = (3 && $

Re: guessing script

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 1:24 PM, Greg Donald wrote: On Thursday 15 April 2004 12:43 pm, James Edward Gray II wrote: Looks like you already got some good answers. Let me add a few minor comments... Thanks for you comments. Is this the best way then? Seems to work, but I'm curious what could be any

Re: guessing script

2004-04-15 Thread Greg Donald
On Thursday 15 April 2004 12:43 pm, James Edward Gray II wrote: > Looks like you already got some good answers. Let me add a few minor > comments... Thanks for you comments. Is this the best way then? Seems to work, but I'm curious what could be any better.. #!/usr/bin/env perl use Math::Ran

why $a became 6 ?

2004-04-15 Thread Jayakumar Rajagopal
$a=100; $b=200; ($a=3 && $b=6 ) if ( 1 == 1 ); print " $a $b \n"; Output : 6 6 OR my syntax is wrong ? regards, Jay -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Missing sequence finder for logfiles

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 8:31 AM, Sten Berg wrote: Sorry! This is what I´ve come up with so far: my $nr=0; my @missing; open (FILE, ") { ($firstbit, $value)=split /:/,$_; $value=trim ($value); if ($firstbit eq "- value ") { if ($nr==256) { $nr=0; print "New Sequence Started\n";

RE: Help with Variable Scope, Regular Expressions

2004-04-15 Thread William Martell
Hi Charles. Thank you very much for the code and the lesson. Works perfectly! I am trying to add the address portion to this but I am still having some trouble. I wanted to see if I could ask you questions regarding your code for even more insight. Thanks in advance for your time and consider

Re: guessing script

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 10:40 AM, Greg Donald wrote: Learning Perl here.. So I wrote this number guessing script but can't see what is wrong with it. I can never get the solution even when I know it's correct. What am I doing wrong? Looks like you already got some good answers. Let me add a few

RE: What has been installed

2004-04-15 Thread Bob Showalter
Harter, Douglas wrote: > When you install a Perl module, it is documented in a file. (I know > this because I remember seeing it when I installed modules.) However, > I have not installed any modules for a good while and forgot what the > file name is. > > I would like to find out what extra mo

Re: guessing script

2004-04-15 Thread WilliamGunther
In a message dated 4/15/2004 12:09:40 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: Learning Perl here.. So I wrote this number guessing script but can't see what is wrong with it. I can never get the solution even when I know it's correct. What am I doing wrong? [Snipped Code] It has

RE: guessing script

2004-04-15 Thread Jayakumar Rajagopal
(my $guess = ); 'my' is your problem.. that creates new varialbe remove it.. HTH Jay -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 11:41 AM To: [EMAIL PROTECTED] Subject: guessing script Learning Perl here.. So I wrote this number guessin

What has been installed

2004-04-15 Thread Harter, Douglas
When you install a Perl module, it is documented in a file. (I know this because I remember seeing it when I installed modules.) However, I have not installed any modules for a good while and forgot what the file name is. I would like to find out what extra modules I have installed. Can someone

RE: untaint path

2004-04-15 Thread Bob Showalter
Angie Ahl wrote: > Hi Gary > > That was it. so using the result of a regex test gets around it.. > That's a wise practice. You should read over "perldoc perlsec". It explains how this works: "The only way to bypass the tainting mechanism is by referencing subpatterns from a regular expres

guessing script

2004-04-15 Thread Greg Donald
Learning Perl here.. So I wrote this number guessing script but can't see what is wrong with it. I can never get the solution even when I know it's correct. What am I doing wrong? #!/usr/bin/env perl use Math::Random; use strict; sub run(){ my $solution = random_uniform_integer(1, 1, 100

Re: Size checking?

2004-04-15 Thread u235sentinel
> I am not sure HOW to do the file size check. (untested) if -s $filename > 100 then print "$filename greater than 100 bytes!"; Something like this perhaps? If you also need the actual size then perhaps this will work (again untested) my $size_in_k = (-s) / 1000; print "$_ is $size_in_k Kbyt

Re: Size checking?

2004-04-15 Thread Wiggins d Anconia
> I have a perl script that FTPs a file down from another server, lately that > file has been corrupt or missing entirely. What I need to do is check the > file and see if it is greater then X number of bytes, if it is then it needs > to use it, if not it needs to delete the file and use the previ

Size checking?

2004-04-15 Thread LoneWolf
I have a perl script that FTPs a file down from another server, lately that file has been corrupt or missing entirely. What I need to do is check the file and see if it is greater then X number of bytes, if it is then it needs to use it, if not it needs to delete the file and use the previous days

Re: s/// w/o RE

2004-04-15 Thread Randal L. Schwartz
> "Wiggins" == Wiggins D'Anconia <[EMAIL PROTECTED]> writes: Wiggins> So do I after 7 years ;-)... And I after twice that. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Tec

Re: "\s" eq "\b" ?

2004-04-15 Thread Rob Dixon
Jenda Krynicky wrote: > > From: "Jayakumar Rajagopal" <[EMAIL PROTECTED]> > > hi friends, > > in regexp, I feel \s and \b behaves same. > > can someone send me a contradiction ? > > $str = "This is a sentence. And this is another."; > > @all_words = ($str =~ /\b(\w+)\b/g); > print join( ', ', @all_

RE: Missing sequence finder for logfiles

2004-04-15 Thread Sten Berg
That´s pretty good, Venu! I´d really like to know in which loop the missing values were found, tough... By "a loop" I mean everytime the values start at zero again. Furthermore, I don´t know how to solve the issue if value 0 is missing in a loop. That number should serve as a startingpoint for

Re: untaint path

2004-04-15 Thread Angie Ahl
Hi Gary That was it. so using the result of a regex test gets around it.. That's a wise practice. I new perl was being mean just for fun. that *so* not perl Thank you so much. Angie Okay Angie, try this one, taken from the docs. It works because I'm setting $PATH to an absolute value inst

Re: Can't locate object method "new" via package "IO::socket::INET"

2004-04-15 Thread Paul Johnson
On Thu, Apr 15, 2004 at 02:01:29PM +0200, test testname wrote: > Hallo Mitglieder, > > Ich suche schon seit Stunden auf allen möglichen > Webseiten über perl herum, aber > komme nicht wirklich weiter... > > Ich will nur ein Standard-Progrämchen aus meinem > Perlbuch starten (Socket- > Programm),

RE: Missing sequence finder for logfiles

2004-04-15 Thread Venugopal P
Will it work? open (TEST, "C:\\sample.log"); my $valcount=0; my $missvalue = 1; while () { if(/value : (\d+)/) { $val = $1; $val = $val - 1 if($val> 0); if ($valcount != $val) { $valc = $valcount + 1 ; print "\nMissing $valc

STOP THREAD ! Can't locate object method "new" via package

2004-04-15 Thread test testname
THANK YOU !!! THAT´s IT ! Jose is right. My editor changed the text I filled in... Sorry for nerving with such easy stuff! Best regards posty Mit schönen Grüßen von Yahoo! Mail - http://mail.yahoo.de -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additiona

Load a CSV / Excel File into a database table

2004-04-15 Thread Mark Martin
Hi I've thrown this query at the mailing list before but I'm still stuck I'm afraid. I have an Excel file with a worksheet that looks like: A BC D - 1¦ STUD_ID GEOG MATH 2¦1

Re: untaint path

2004-04-15 Thread Gary Stainburn
Okay Angie, try this one, taken from the docs. It works because I'm setting $PATH to an absolute value instead of updating it. You may want to play with the regex to improve it, but this basic test worked. #!/usr/bin/perl -Tw my $PATH=$ENV{'MYPATH'}; print "PATH=$PATH\n"; if ($PATH=~/^([-\/\

Re: Missing sequence finder for logfiles

2004-04-15 Thread Sten Berg
Sorry! This is what I´ve come up with so far: my $nr=0; my @missing; open (FILE, ") { ($firstbit, $value)=split /:/,$_; $value=trim ($value); if ($firstbit eq "- value ") { if ($nr==256) { $nr=0; print "New Sequence Started\n"; } if ("$value" ne "$nr") { print"read

Re: untaint path

2004-04-15 Thread Angie Ahl
Hi Gary thanks for that. Makes sense. Sadly didn't work though: Here's some sample code: my $HTML_Path = ""; if ($arg{HTML_Path}) {$HTML_Path = $arg{HTML_Path};} $HTML_Path =~ s#^(~|../)##; my $newdir = $HTML_Path . "/usr/" . $un; mkdir $newdir; If I comment the line passing the arg{HTML_Path}

Re: Missing sequence finder for logfiles

2004-04-15 Thread James Edward Gray II
On Apr 15, 2004, at 7:08 AM, Sten Berg wrote: Hi gurus! I´m looking for a way of analysing a log file and pinpoint missing sequences (foreach loop?). The logfiles looks something like this: LOGFILE - value : 0 some data... - value : 1 some data... - value : 2 some data... ... ... - value : 255

Re: untaint path

2004-04-15 Thread Gary Stainburn
Hi Angie, it's a while since I've looked at this, so no warranty. On Thursday 15 Apr 2004 12:55 pm, Angie Ahl wrote: > Hi everyone. > > I'm trying to work out how to untaint a path to passed to modules. > > eg/stupidly/long/path/here > > contains the folders perl and html > > I want to be able th

Can't locate object method "new" via package "IO::socket::INET"

2004-04-15 Thread test testname
Dear Members, I am searching for hours in every websites about perl, but havn´t had success... I just want to start a standard-program from my perlbook (socket-program), but get an error, which is not retraceable for me. Code: (XXX.XXX.XXX.XXX is my IP-adress, which I opt out for privacy reason

Missing sequence finder for logfiles

2004-04-15 Thread Sten Berg
Hi gurus! I´m looking for a way of analysing a log file and pinpoint missing sequences (foreach loop?). The logfiles looks something like this: LOGFILE - value : 0 some data... - value : 1 some data... - value : 2 some data... ... ... - value : 255 some data... - value : 0 some data... - value :

Can't locate object method "new" via package "IO::socket::INET"

2004-04-15 Thread test testname
Hallo Mitglieder, Ich suche schon seit Stunden auf allen möglichen Webseiten über perl herum, aber komme nicht wirklich weiter... Ich will nur ein Standard-Progrämchen aus meinem Perlbuch starten (Socket- Programm), aber bekomme einen Fehler, der für mich nicht nachvollziebar ist: Code: (XXX.XX

untaint path

2004-04-15 Thread Angie Ahl
Hi everyone. I'm trying to work out how to untaint a path to passed to modules. eg/stupidly/long/path/here contains the folders perl and html I want to be able the get the following ENV var from apache like so: local our $HTMLPath = $ENV{HTML_TEMPLATE_ROOT}; And pass it to a module so it can

RE: Avoiding using temporary files

2004-04-15 Thread Barrett-Small, Richard
Thank you so much for this, Jenda and Daniel and Adam Could you give me a stab of code demonstrating appending or printing a record (like the one below) to a scalar (or pushing to an array) and how I might avoid printing OUT but retain the changes I made to the filehandle so they can be passed to