Re: subroutine definitions

2004-02-27 Thread John W. Krahn
Andrew Gaffney wrote: > > I'm trying to write a subroutine that takes two scalars and two arrays as > parameters. I've > read that if you try to do this in a function, both arrays will get combined within > '@_'. All the values, including the two scalars, will be combined in a single list and b

Re: CODING STYLE (was Re: Count the number of lines in a file without actually iterating through the file)

2004-02-27 Thread John W. Krahn
Wc -Sx- Jones wrote: > > Most employers (and a quiet a few IT managers) are not very Perl savvy > and would like you Perl people (read POD) to be more like COBOL people > (read BOOKS.) Don't you mean "we Perl people" or are you inferring that you are not "a Perl person?" > Can we please leave th

subroutine definitions

2004-02-27 Thread Andrew Gaffney
I'm trying to write a subroutine that takes two scalars and two arrays as parameters. I've read that if you try to do this in a function, both arrays will get combined within '@_'. Instead, I want the subroutine to take two scalars and two array references. I will not be doing any modification o

Re: CODING STYLE (was Re: Count the number of lines in a file without actually iterating through the file)

2004-02-27 Thread WC -Sx- Jones
zsdc wrote: WC -Sx- Jones wrote: Can we please leave the Perl Golf in the appropriate context or at least make a warning in/at the start of the message that the post may confuse beginners? I didn't make any warning in my last post. I wrote an explaination instead. I hope that's acceptable...

Manipulating date entries in a mysql database

2004-02-27 Thread peter Newton
Hello everyone, I am a beginner with perl and I am creating a small mysql database where I need to extract information conditionally (in part) on the date information. ie: WHERE date > startdate AND < finishdate What is the BEST way to store the date with perl so that I can perform all sor

Re: CODING STYLE (was Re: Count the number of lines in a file without actually iterating through the file)

2004-02-27 Thread zsdc
WC -Sx- Jones wrote: Can we please leave the Perl Golf in the appropriate context or at least make a warning in/at the start of the message that the post may confuse beginners? I didn't make any warning in my last post. I wrote an explaination instead. I hope that's acceptable... -- ZSDC -- To

CODING STYLE (was Re: Count the number of lines in a file without actually iterating through the file)

2004-02-27 Thread WC -Sx- Jones
R. Joseph Newton wrote: Bryan Harris wrote: perl -lpe '}{*_=*.}{' file Ooh, an obfuscated verbose way of writing: perl -lpe'}{$_=$.' file Huh? Could someone explain this? The "}{" makes no sense to me... Well, as Momma used to say: "Just look the other way. Ignore it, and maybe it will go a

Re: newline or CR with join function

2004-02-27 Thread R. Joseph Newton
Gregg O'Donnell wrote: > Greetings all, > Instead of joining my scalars with ',' I'd like each to appear on a newline. > Replacing ',' with '\n' doesn't work. "\n" would. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Module to pull Netstat summary information?

2004-02-27 Thread WC -Sx- Jones
R. Joseph Newton wrote: WC -Sx- Jones wrote: Better would be - #!/usr/bin/perl -w # just predeclare them ALL here; before they are used. # See my comments below ... &print_if_Warn if (system("nstat -a") / 256); &print_if_Fatal if (system("netstat -nr") / 256); Hi Bill, I'm a little uncle

Re: subroutine placement (Layout conventions)

2004-02-27 Thread R. Joseph Newton
B McKee wrote: > Hi All, > > I'm slowly creating my Perl Masterpiece (tm) > I'll let ya all giggle over it when I'm done :-) > At any rate - It's done what I believe you call "top-down". > I declare the subs, Not generally necessary, and oftentimes problematic, in Perl > then have the co

Re: Count the number of lines in a file without actually iterating through the file

2004-02-27 Thread zsdc
R. Joseph Newton wrote: Huh? Could someone explain this? The "}{" makes no sense to me... Well, as Momma used to say: "Just look the other way. Ignore it, and maybe it will go away..." I would not be at all surprised if the code above works, and does *something*. I just prefer to use code that

Re: subroutine call weirdness

2004-02-27 Thread Michael C. Davis
At 08:54 PM 2/27/04 -0800, R. Joseph Newton wrote: >I think it might also be good to refer the OP back to James' post, which he seems >to have overlooked. The caveat you provided earlier still makes sense. Thanks for the ideas. Are you referring to James' suggestion about always using parens on

Re: Module to pull Netstat summary information?

2004-02-27 Thread R. Joseph Newton
WC -Sx- Jones wrote: > Better would be - > #!/usr/bin/perl -w ... > &print_if_Warn if (system("nstat -a") / 256); > > &print_if_Fatal if (system("netstat -nr") / 256); Hi Bill, I'm a little unclear here. What do you see as calling for the ampersand & in the function calls above. Most list

Re: Count the number of lines in a file without actually iterating through the file

2004-02-27 Thread R. Joseph Newton
Bryan Harris wrote: > >> perl -lpe '}{*_=*.}{' file > > > > Ooh, an obfuscated verbose way of writing: > > > > perl -lpe'}{$_=$.' file > > Huh? Could someone explain this? The "}{" makes no sense to me... Well, as Momma used to say: "Just look the other way. Ignore it, and maybe it will go awa

Re: DBI Problem

2004-02-27 Thread jeremy
Well I have a table if information with 3 columns being populated by perl variables drawn from an SQL database. The leftmost table will always get populated. the two right colums have a link in them. the anhcor tags always show up, but not the text for the link. The fields should never be blank,

Re: subroutine call weirdness

2004-02-27 Thread R. Joseph Newton
Rob Dixon wrote: > Michael C. Davis wrote: > > > > At 01:31 AM 2/28/04 +1100, David le Blanc wrote: > > >Now remember, a perl 'prototype' is not a prototype in the regular > > >sense, > > >but a method to override perl's natural greedy argument list collection, > > >and a method to create function

Re: subroutine call weirdness

2004-02-27 Thread R. Joseph Newton
James Edward Gray II wrote: > On Feb 27, 2004, at 6:55 AM, Michael C. Davis wrote: > > > Hi list, > > > > I just ran across some unexpected results in passing arguments to > > user-defined subroutines. Could someone who has been around Perl a > > while > > longer check this and make sure I'm seei

RE: Module to pull Netstat summary information?

2004-02-27 Thread Michael C. Davis
At 03:19 PM 2/28/04 +1100, David le Blanc wrote: > >Are you developing for Linux? A generic Linux PROC handler might >be they way you go. Want to achieve CPAN developer status? :-) OK, that's the "glory" part. Now which way to the "fortune"? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: how to remove an element in an array

2004-02-27 Thread R. Joseph Newton
David Inglis wrote: > Is there a command to drop an element from an array, or what is the best > way to do this. > > Any help appreciated. > > -- > Regards > > David Inglis If at all possible, design around the need. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

RE: Module to pull Netstat summary information?

2004-02-27 Thread David le Blanc
> -Original Message- > From: Michael C. Davis [mailto:[EMAIL PROTECTED] > Sent: Saturday, 28 February 2004 4:37 AM > To: [EMAIL PROTECTED] > Subject: Re: Module to pull Netstat summary information? > > Hey, don't forget the end users on windows. At last count > there were more > than ..

Re: Perl Installation

2004-02-27 Thread R. Joseph Newton
KENNETH JANUSZ wrote: > I have downloaded 5.8 from ActiveState. Before I install it are they any "Gotchas" > or glitches that I should know about? > > Thanks much, > Ken Janusz, CPIM If you have ever installed Perl to some non-standard location, the installer may try to default-install to that

RE: Module to pull Netstat summary information?

2004-02-27 Thread David le Blanc
> -Original Message- > From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] > Sent: Saturday, 28 February 2004 4:00 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: Module to pull Netstat summary information? > > Please bottom post > > > This works however I was hoping perl

RE: Trainset - initial release

2004-02-27 Thread David le Blanc
> -Original Message- > From: James Edward Gray II [mailto:[EMAIL PROTECTED] > Sent: Saturday, 28 February 2004 6:27 AM > To: Gary Stainburn > Cc: [EMAIL PROTECTED] > Subject: Re: Trainset - initial release > > On Feb 27, 2004, at 8:32 AM, Gary Stainburn wrote: > > > Hi folks, > > Howdy.

Re: Recursive Archive::Tar?

2004-02-27 Thread R. Joseph Newton
Jas wrote: > Not sure if this is the way it is supposed to work, but I am not sure > how I can get a directory, like a web directory backed up in one step > using Archive::Tar. > > Code... > > #!/usr/bin/perl > > use strict; > use Archive::Tar; > > my $bu = Archive::Tar->create_archive("www.tar",0

Re: target practice -- lottery numbers

2004-02-27 Thread Wiggins d'Anconia
R. Joseph Newton wrote: Cy Kurtz wrote: Hi all. I have a little program here that generates a lottery play slip for the mega-millions game. It selects 50 of the 52 numbers exactly once over 10 tickets of 5 numbers each. It then selects 10 super ball numbers, one for each ticket. It then prints it

RE: target practice -- lottery numbers

2004-02-27 Thread David le Blanc
> > > $k=1; > > while($k<(($i-1)*5+$j)){ > > Pop quiz time. What's easier to read, the above or this: > > while( $k < ( ( $i - 1 ) * 5 + $j ) ) { > > We won't bill you for the whitespace. ;) > That is of course assuming that *indiscriminate* padding with spaces incre

Re: target practice -- lottery numbers

2004-02-27 Thread R. Joseph Newton
Cy Kurtz wrote: > Hi all. I have a little program here that generates a lottery play slip > for the mega-millions game. It selects 50 of the 52 numbers exactly once > over 10 tickets of 5 numbers each. It then selects 10 super ball > numbers, one for each ticket. It then prints it all out(duh). >

Re: DBI Problem

2004-02-27 Thread Wiggins d'Anconia
Jeremy Bush wrote: Hi, im using DBI to connect to a SQL database in order to serve dynamic content. Some people have reported to me that some fields are blank on my dynamic pages. It is as if the variable that is supposed to hold the data is being returned with no information it it. I have only

RE: Capture/Display a program's output in an ASP page

2004-02-27 Thread Charles K. Clarkson
Pete <[EMAIL PROTECTED]> wrote: : : I would like to Capture/Display a program's output in an ASP page. : : Here's the program:(TestProg.pl) : --- : print "This line came from my test perl program"; : : : Here is ASP to excute the program that some

Capture/Display a program's output in an ASP page

2004-02-27 Thread PerlDiscuss - Perl Newsgroups and mailing lists
I would like to Capture/Display a program's output in an ASP page. Here's the program:(TestProg.pl) --- print "This line came from my test perl program"; Here is ASP to excute the program that some nice person on this Newgroup gave me. It executes

RE: target practice -- lottery numbers

2004-02-27 Thread Charles K. Clarkson
Here's my entry. I took a different approach than James. I don't like to collect the data and produce the report at the same time. Both our approaches are valid, though. I tried to stick with James' report structure. Perl allows us to be selective with our styles. I find it a comfortable

Re: subroutine call weirdness

2004-02-27 Thread Rob Dixon
Michael C. Davis wrote: > > At 01:31 AM 2/28/04 +1100, David le Blanc wrote: > >Now remember, a perl 'prototype' is not a prototype in the regular > >sense, > >but a method to override perl's natural greedy argument list collection, > >and a method to create functions which emulate perl's builtins

Re: Count the number of lines in a file without actually iterating through the file

2004-02-27 Thread James Edward Gray II
On Feb 27, 2004, at 1:13 PM, Bryan Harris wrote: perl -lpe '}{*_=*.}{' file Ooh, an obfuscated verbose way of writing: perl -lpe'}{$_=$.' file Huh? Could someone explain this? The "}{" makes no sense to me... I thought the same thing, when I read it! I'm still not sure I get it, but perlrun

Re: Count the number of lines in a file without actually iterating through the file

2004-02-27 Thread Wiggins d Anconia
> > > >> perl -lpe '}{*_=*.}{' file > > > > Ooh, an obfuscated verbose way of writing: > > > > perl -lpe'}{$_=$.' file > > > Huh? Could someone explain this? The "}{" makes no sense to me... > > - B You're not the first. There was recently much discussion about this on the Fun with Perl l

Re: Trainset - initial release

2004-02-27 Thread James Edward Gray II
On Feb 27, 2004, at 8:32 AM, Gary Stainburn wrote: Hi folks, Howdy. as many of you who follow this list will know, a while back I decided to learn OOP and set myself the task of simulating a railway system. A number of people asked if I could make the code available for viewing in order to hel

Re: Count the number of lines in a file without actually iterating through the file

2004-02-27 Thread Bryan Harris
>> perl -lpe '}{*_=*.}{' file > > Ooh, an obfuscated verbose way of writing: > > perl -lpe'}{$_=$.' file Huh? Could someone explain this? The "}{" makes no sense to me... - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Module to pull Netstat summary information?

2004-02-27 Thread Wiggins d Anconia
> At 09:59 AM 2/27/04 -0700, Wiggins d Anconia wrote: > >It appears netstat just reads the values from /proc/net and prints them > >in a nice way, so presumably you could use standard opens on the /proc > >files and read specifically what you want rather than having netstat > >parse them for you.

Re: Recursive Archive::Tar?

2004-02-27 Thread david
Jas wrote: > Not sure if this is the way it is supposed to work, but I am not sure > how I can get a directory, like a web directory backed up in one step > using Archive::Tar. > > Code... > > #!/usr/bin/perl > > use strict; > use Archive::Tar; > > my $bu = Archive::Tar->create_archive("www.ta

Re: target practice -- lottery numbers

2004-02-27 Thread James Edward Gray II
(Let's keep our discussion on the list, so we can all help and learn.) On Feb 27, 2004, at 9:28 AM, Cy Kurtz wrote: Here is my updated code, in case you're interested. It's not as elegant as your code(I can see I have a lot to learn!), but it works for me. I'm still studying your code. Thank you

Re: Module to pull Netstat summary information?

2004-02-27 Thread Michael C. Davis
At 09:59 AM 2/27/04 -0700, Wiggins d Anconia wrote: >It appears netstat just reads the values from /proc/net and prints them >in a nice way, so presumably you could use standard opens on the /proc >files and read specifically what you want rather than having netstat >parse them for you. Though thi

Re: subroutine placement (Layout conventions)

2004-02-27 Thread Wiggins d Anconia
> From: "Wiggins d Anconia" <[EMAIL PROTECTED]> > > I like most of this answer. I would add that you should drop the > > declarations of the subs, they are unneeded in Perl and can break some > > "features". This will help to some extent depending on your calling > > order. > > ??? > > 1. The

Re: Module to pull Netstat summary information?

2004-02-27 Thread Wiggins d Anconia
Please bottom post > This works however I was hoping perl had a module so I didn't have to run a system application. I've been playing around with modules such as scp, telnet and ftp. I'm curious if there is one for netstat. > > thanks :-) > > I am still new to working with Perl myself but

RE: subroutine call weirdness

2004-02-27 Thread Michael C. Davis
At 01:31 AM 2/28/04 +1100, David le Blanc wrote: >Now remember, a perl 'prototype' is not a prototype in the regular >sense, >but a method to override perl's natural greedy argument list collection, >and a method to create functions which emulate perl's builtins (ie, >provide >hints to the expected

Re: how to remove an element in an array

2004-02-27 Thread Wiggins d Anconia
> Is there a command to drop an element from an array, or what is the best > way to do this. > > Any help appreciated. > perldoc -f delete http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: subroutine call weirdness

2004-02-27 Thread Michael C. Davis
At 02:32 PM 2/27/04 -, Rob Dixon wrote: >I haven't looked at this at all carefully, but my first guess would be >be that you need to call the subroutine as if it was one: > > print MyProject::CoreConstants::EarliestValidTimestampAsNumber() + 1, "\n"; Yes, this certainly solves the problem I'm

Re: subroutine call weirdness

2004-02-27 Thread Rob Dixon
David Le Blanc wrote: > > > From: Michael C. Davis [mailto:[EMAIL PROTECTED] > > Sent: Friday, 27 February 2004 11:55 PM > > To: [EMAIL PROTECTED] > > Subject: subroutine call weirdness > > > > Hi list, > > > > I just ran across some unexpected results in passing arguments to > > user-defined subro

Trainset - initial release

2004-02-27 Thread Gary Stainburn
Hi folks, as many of you who follow this list will know, a while back I decided to learn OOP and set myself the task of simulating a railway system. A number of people asked if I could make the code available for viewing in order to help me with my questions. I think that I have now done enoug

Re: subroutine call weirdness

2004-02-27 Thread Rob Dixon
Michael C. Davis wrote: > > I just ran across some unexpected results in passing arguments to > user-defined subroutines. Could someone who has been around Perl a while > longer check this and make sure I'm seeing this right? > > I've got some code that implements a constant as a subroutine call (

RE: subroutine call weirdness

2004-02-27 Thread David le Blanc
> From: Michael C. Davis [mailto:[EMAIL PROTECTED] > Sent: Friday, 27 February 2004 11:55 PM > To: [EMAIL PROTECTED] > Subject: subroutine call weirdness > > Hi list, > > I just ran across some unexpected results in passing arguments to > user-defined subroutines. Could someone who has been aro

Re: subroutine call weirdness

2004-02-27 Thread James Edward Gray II
On Feb 27, 2004, at 6:55 AM, Michael C. Davis wrote: Hi list, I just ran across some unexpected results in passing arguments to user-defined subroutines. Could someone who has been around Perl a while longer check this and make sure I'm seeing this right? I've got some code that implements a c

Re: how to remove an element in an array

2004-02-27 Thread Rob Dixon
David Inglis wrote: > > Is there a command to drop an element from an array, or what is the best > way to do this. Hi David. A call to 'splice' is the usual answer, but sometimes you may want the remaining elements to keep their indices. A call to 'delete' will shrink an array if you delete from

Re: Array question

2004-02-27 Thread Tim
At 07:18 PM 2/26/04 -0500, you wrote: Hi Guys, I have a problem with e-mail address's and an array. I have some code that will be a documentation spider to go through all our technical documentation, extract e-mail address's and attempt to sort and exclude certain e-mails/patterns. All documentati

subroutine call weirdness

2004-02-27 Thread Michael C. Davis
Hi list, I just ran across some unexpected results in passing arguments to user-defined subroutines. Could someone who has been around Perl a while longer check this and make sure I'm seeing this right? I've got some code that implements a constant as a subroutine call (to keep the constant from