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

2003-12-14 Thread Jerry Rocteur
Hi, 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', I could understand the requirement inside a sub routing but in the main code it gives me the willies. My DBI Perl is

Re: Parentheses

2003-12-14 Thread Steve Grazzini
[ Remailed to the list (sorry about that, Rob) ] On Dec 13, 2003, at 9:07 AM, Rob Dixon wrote: As a final thought, I would point out that $_ is a package ('our') variable, but is localised by 'map', 'grep', 'foreach (LIST)' and 'while (<>)'. Actually, $_ isn't localized by 'while(<>)': % echo

RE: Getting the most recent file

2003-12-14 Thread Paul Harwood
One question I have: With this statement: @files = sort { -M $a <=> -M $b } @files; How does Perl understand that these are files and not just text entries? Did using the readdir beforehand make this possible? -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Posted At: Sat

Re: Split question

2003-12-14 Thread Josimar Nunes de Oliveira
Try this: @temp = split('\#', "abc#def#ghi#jkl") ; foreach (@temp){ print "\n", $_; } Josimar - Original Message - From: "Perl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, December 14, 2003 3:16 AM Subject: Split question > Hi, >i am new to Perl. >here is my que

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

2003-12-14 Thread Jerry Rocteur
On Saturday, Dec 13, 2003, at 18:12 Europe/Brussels, Jerry Rocteur wrote: Hi, 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', I could understand the requirement inside

Re: Getting the most recent file

2003-12-14 Thread Rob Dixon
Paul Harwood wrote: > > One question I have: > > With this statement: > > @files = sort { -M $a <=> -M $b } @files; > > How does Perl understand that these are files and not just text entries? > Did using the readdir beforehand make this possible? Well they /are/ just text entries! But ones that c

Re: Parentheses

2003-12-14 Thread Rob Dixon
Steve Grazzini wrote: > > On Dec 13, 2003, at 9:07 AM, Rob Dixon wrote: > > As a final thought, I would point out that $_ is a package ('our') > > variable, but is localised by 'map', 'grep', 'foreach (LIST)' and > > 'while (<>)'. > > Actually, $_ isn't localized by 'while(<>)': > > % echo te

Re: Parentheses

2003-12-14 Thread Rob Dixon
R. Joseph Newton wrote: > > Rob Dixon wrote: > > > > foreach (@lines) { > > # too many lines here > > > > } > > > > > > While the purpose of the above may bve totally > > > incomprehesible, there is no question about what $_ is. <;:-o) > > > > One proviso here. I always feel very uncomfortable ab

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. I've tried perldoc warnings and

list problem

2003-12-14 Thread km
Hi all, when i use range operator in foreach loop it increases the elements in the list by one. for eg : foreach(1..10) { print; } #prints 1,2,3,4,5,6,7,8,9,10 but if i need to set a hop for each number how do i get it ? something like stride functionality so that it will print 1,4,7,10 so

Re: Parentheses

2003-12-14 Thread R. Joseph Newton
Rob Dixon wrote: > R. Joseph Newton wrote: > > > > Rob Dixon wrote: > > > ...has the same effect as printing from inside the loop. > > Which means that my array contents > > > > have either been effectively modified, or totally hashed, > > depending on whether that was the desired effect. > > ..ex

Re: list problem

2003-12-14 Thread John W. Krahn
Km wrote: > > Hi all, Hello, > when i use range operator in foreach loop it increases the > elements in the list by one. > for eg : > foreach(1..10) > { > print; > } > #prints 1,2,3,4,5,6,7,8,9,10 > > but if i need to set a hop for each number how do i get it ? > something like stride functio

Re: list problem

2003-12-14 Thread Fred Nastos
On December 14, 2003 01:21 pm, km wrote: > > but if i need to set a hop for each number how do i get it ? something like > stride functionality so that it will print 1,4,7,10 something like > > for(1..10 ,jump 3) > { > print; > } How about the old-fashioned way? for ($i=1; $i<=10) { prin

Re: Split question

2003-12-14 Thread John W. Krahn
Josimar Nunes De Oliveira wrote: > > From: "Perl" <[EMAIL PROTECTED]> > > > > @temp = split(/#/, "abc#def#ghi#jkl") ; > > > > doesn't seem to work. > > > > am i doing anything wrong here ? > > Try this: > > @temp = split('\#', "abc#def#ghi#jkl") ; > foreach (@temp){ > print "\n", $_; > } The

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: list problem

2003-12-14 Thread John W. Krahn
Fred Nastos wrote: > > On December 14, 2003 01:21 pm, km wrote: > > > > but if i need to set a hop for each number how do i get it ? something like > > stride functionality so that it will print 1,4,7,10 something like > > > > for(1..10 ,jump 3) > > { > > print; > > } > > How about the old-fashi

RE: Question for this Group ... dont flame me :)

2003-12-14 Thread Jenda Krynicky
From: Jeff Westman <[EMAIL PROTECTED]> > Guay_Jean-Sébastien <[EMAIL PROTECTED]> wrote: > > b) As new need arises in your program, using a module gives you > > access to other functionality which you would have to (again) write > > yourself if you were not unsing a module. > > But would you agree,

Re: Split question

2003-12-14 Thread Joel Newkirk
On Sun, 2003-12-14 at 14:52, John W. Krahn wrote: > Josimar Nunes De Oliveira wrote: > > > > From: "Perl" <[EMAIL PROTECTED]> > > > > > > @temp = split(/#/, "abc#def#ghi#jkl") ; > > > > > > doesn't seem to work. > > > > > > am i doing anything wrong here ? > > > > Try this: > > > > @temp = spl

Re: Split question

2003-12-14 Thread R. Joseph Newton
Joel Newkirk wrote: > > The first argument to split is converted to a regular expression and the > > '#' character is not special in a regular expression so split/#/ and > > split'\#' do exactly the same thing. > > Well, actually they don't, since the 'bare' # will be interpreted as > starting a c

Re: Split question

2003-12-14 Thread John W. Krahn
Joel Newkirk wrote: > > On Sun, 2003-12-14 at 14:52, John W. Krahn wrote: > > Josimar Nunes De Oliveira wrote: > > > > > > From: "Perl" <[EMAIL PROTECTED]> > > > > > > > > @temp = split(/#/, "abc#def#ghi#jkl") ; > > > > > > @temp = split('\#', "abc#def#ghi#jkl") ; > > > > The first argument to s

Re: could use an audit

2003-12-14 Thread Kenton Brede
On Fri, Dec 12, 2003 at 06:20:45PM -0600, Kenton Brede wrote: > I've cobbled some code together that will allow me to parse a file Thanks all for your help. I've learned a ton:) Kent -- "I am always doing that which I can not do, in order that I may learn how to do it." --Pablo Picasso -

Re: Split question

2003-12-14 Thread James Edward Gray II
On Dec 14, 2003, at 6:42 PM, R. Joseph Newton wrote: The only problem I see with John's code is that it addumes that the print statement will print a newline, which it doesn't [at least on my installation of V5.8]. Na, John's smarter than you give him credit for here. Here was the code: On Dec

hash sorting

2003-12-14 Thread B. Rothstein
I have a hash where each key is a first name linked to a last name, any suggestions on how to loop through the hash to sort the list by the last names? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: hash sorting

2003-12-14 Thread Randy W. Sims
On 12/15/2003 3:17 AM, B. Rothstein wrote: I have a hash where each key is a first name linked to a last name, any suggestions on how to loop through the hash to sort the list by the last names? Check the Perl FAQ. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Re: hash sorting

2003-12-14 Thread Owen
On Mon, 15 Dec 2003 00:17:17 -0800 "B. Rothstein" <[EMAIL PROTECTED]> wrote: > I have a hash where each key is a first name linked to a last name, any > suggestions on how to loop through the hash to sort the list by the last > names? Something like this perhaps? #!/usr/bin/perl -w use strict