Re: Time and date formats

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Troy May wrote: > What do the letters after the "%02" mean? I know about "%02d", but I came > across a few scripts with "%02u" in it. I've never seen that, what does it > mean? What's the difference between the "d" and the "u"? And what ELSE can > you possibly use there?

RE: Time and date formats

2002-03-01 Thread Timothy Johnson
Check the documentation on sprintf(). I don't have perl with me, but I think "perldoc -f sprintf" will find it, otherwise you can look through the perlfunc section of the docs for sprintf. Offhand I'd guess that %02u refers to an unsigned integer in decimal format? -Original Message-

Time and date formats

2002-03-01 Thread Troy May
What do the letters after the "%02" mean? I know about "%02d", but I came across a few scripts with "%02u" in it. I've never seen that, what does it mean? What's the difference between the "d" and the "u"? And what ELSE can you possibly use there? -- To unsubscribe, e-mail: [EMAIL PROTECTED

Forgive my n00biness

2002-03-01 Thread Aaron Shurts
I have a hash tables that looks like this: my(%data) = (); my($csid) = ''; $data{$csid} = {}; $data{$csid}{duration_on} += 0; $data{$csid}{duration_off} += 0; $data{$csid}{under_peak} += 0; $data{$csid}{over_peak} += 0; $data{$csid}{under_off} += 0; $data{$csid}{ov

Re: perl serial port program

2002-03-01 Thread Papo Napolitano
You should change the line die "Device::SerialPort Aborted without match\n" unless (defined $data); to read die "Device::SerialPort Aborted without match\n" unless (defined $bytein); But be careful because the 'lookfor' method causes Device::SerialPort to return an entire line (up to t

RE: what's the point of Foreach?

2002-03-01 Thread Nikola Janceski
All I have to say is... (perldoc perlsyn; goto line 145) The following compound statements may be used to control flow: if (EXPR) BLOCK if (EXPR) BLOCK else BLOCK if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK LABEL while (EXPR) BLOCK LAB

Re: what's the point of Foreach?

2002-03-01 Thread Bradford Ritchie
The perlsyn doc says that "foreach" is a synonym for "for", so the two are indeed interchangable. But you should also note that there are 2 different "modes" in which the for/foreach statement works. If you use it in the C-style "for($x=1; $x<10; $x++) {}" way, then $x is not localized to the lo

Re: appending to rows

2002-03-01 Thread John W. Krahn
Tony Ho wrote: > > Hi guys Hello, > I was wondering if you could help me > > I have 2 files. > One file has 3 data rows, A, B and C > The file has 1 data row D. > > I need to append row D to rows A and C in the first file, based on some > condition. > Any ideas how I could go about this ? >

Re: some questions about for, foreach

2002-03-01 Thread John W. Krahn
Jon Molin wrote: > > Jan Gruber wrote: > > > > Hi, Jon && list ! > > On Friday 01 March 2002 11:29 am, you wrote: > > > Hi list! > > > > > > I've always thought there's a difference between for and foreach, that > > > for uses copies and foreach not. But there's no diff is there? > > > > AFAIK th

Re: die handler : posting again.

2002-03-01 Thread Tanton Gibbs
Ok, I actually gave this a shot, and it works...sort of. However, the original die still prints out the first argument of the array which is an array reference. However, you can change what die is called with from your die_handler by calling die again, so if you just want to print a message, I w

RE: perl serial port program

2002-03-01 Thread Jeff Liu
Hi Papo, Thank you very much for your information. I can send to serial port from my script now. But when I try to read from the port, my script died and showed "Device::SerialPort Aborted without match". Do you have any idea about how can I fix the problem? My script is as followed. #!/usr/bi

Re: Sendmail Problems

2002-03-01 Thread William.Ampeh
Instead of sendmail simply use mail or mailx. See script below. Please make sure you change the From: addy... to a valid email address, you do not want your email server to be black listed. You know what I mean? That's bad. #!/opt/local/bin/perl #---

Re: what's the point of Foreach?

2002-03-01 Thread James Taylor
Oops, sorry it was just pointed out to me today that this was already asked today :) There are over 1000 unread messages in my Perl folder and I didn't think to look through them all On Friday 01 March 2002 11:52 am, you wrote: > I'm really curious what the point of foreach is considering for d

Re: die handler : posting again.

2002-03-01 Thread Jeff 'japhy' Pinyan
On Mar 1, Sethi, Pradeep said: >I have this in my code : > >local $SIG{__DIE__} = \&die_handler; > >sub die_handler { > my (@vars)=@_; > print STDERR "\nfirst : " . $vars[0]; > print STDERR "\nsecond : " . $vars[1]; >} > >if i give : > >die ('goo','foo','bar'); > >Then I get the output : > >fi

Re: die handler : posting again.

2002-03-01 Thread Tanton Gibbs
According to perldoc -f die and perldoc perlvar # look at %SIG{expr} the die_handler will be called with the string die was passed. From the perldoc -f die, die will concatenate all parameters together. Therefore, your problem makes sense. You might try passing an array reference containing th

Sendmail Problems

2002-03-01 Thread Joseph Bajin
I am trying to get this program to send mail. Unfortunately I am having a hard time using sendmail. Could someone please help me out. Thanks, ##Error Reporting sub Notifyanddie { my $message = shift; open(MAIL, "|/usr/lib/sendmail -t -i") or die "Couldn't open sendmail $!\n"; print M

Re: what's the point of Foreach?

2002-03-01 Thread Chas Owens
On Fri, 2002-03-01 at 14:52, James Taylor wrote: > I'm really curious what the point of foreach is considering for does the same > exact thing? For example: > > @myarray = (1 .. 10); > > for (@myarray) { >print "$_\n"; > } > > > Or, you could swap the for for a foreach and the same thing

Re: what's the point of Foreach?

2002-03-01 Thread Chas Owens
On Fri, 2002-03-01 at 14:52, James Taylor wrote: > I'm really curious what the point of foreach is considering for does the same > exact thing? For example: > > @myarray = (1 .. 10); > > for (@myarray) { >print "$_\n"; > } > > > Or, you could swap the for for a foreach and the same thing

Re: Sendmail Problems

2002-03-01 Thread Chas Owens
On Fri, 2002-03-01 at 14:43, Joseph Bajin wrote: > I am trying to get this program to send mail. Unfortunately I am having > a hard time using sendmail. Could someone please help me out. > > Thanks, > > ##Error Reporting > sub Notifyanddie { > my $message = shift; > open(MAIL, "|/usr

what's the point of Foreach?

2002-03-01 Thread James Taylor
I'm really curious what the point of foreach is considering for does the same exact thing? For example: @myarray = (1 .. 10); for (@myarray) { print "$_\n"; } Or, you could swap the for for a foreach and the same thing would get accomplished... The only difference I can think of is a sli

Re: strip first space

2002-03-01 Thread Elaine -HFB- Ashton
[EMAIL PROTECTED] [[EMAIL PROTECTED]] quoth: *> *>$string =~ s/^\s+//; Removes leading whitespaces *> *>$string =~ s/^\s+//g; /g (GLOBALLY) is redundant in the *>case of "leading whitespages" For a beginner, it's a not a critical detail. e. -- To unsubscribe,

RE: strip first space

2002-03-01 Thread Jason Larson
> If I have a string and the first character is a space, > may not always be a space. > Example: John > Tommy > Beth > > John and Beth have a space, Tommy does not. > How do I strip that. I do not want to use the global > command because a want the space between Fir

RE: How can I distrubit a Perl execute envrioment

2002-03-01 Thread Timothy Johnson
The registry changes made by ActivePerl are mainly to register the program so that you can uninstall it and create the appropriate file associations with .pl files. We run a perl script as part of our login process. So that we don't have to install it on all of the clients, we run it from the n

Re: strip first space

2002-03-01 Thread William.Ampeh
$string =~ s/^\s+//; Removes leading whitespaces $string =~ s/^\s+//g; /g (GLOBALLY) is redundant in the case of "leading whitespages" See PERL Cookbook page 30 for the answer to your question. __ William Ampeh (x3939) Federal Reserve Board

Re: How can I distrubit a Perl execute envrioment

2002-03-01 Thread Ricky
Thank you! While, what I worry about is that the Registry changes made buy Active, will it effect my script which using a downloaded module not a default installed module? "Timothy Johnson" <[EMAIL PROTECTED]> wrote in message C0FD5BECE2F0C84EAA97D7300A500D5002581012@SMILEY...">news:C0FD5BECE2F0C8

Re: strip first space

2002-03-01 Thread Elaine -HFB- Ashton
Tanton Gibbs [[EMAIL PROTECTED]] quoth: *> *>The regular expression *>s/^\s//; s/^\s+//g; would be even better as it would remove all whitspace at the beginning of a line and it would replace all matches to the pattern instead of just the first it finds. e. -- To unsubscribe, e-mail: [EMAIL P

Re: strip first space

2002-03-01 Thread Tanton Gibbs
my @arr = (" This has a leading space", "This does not" ); foreach my $string (@arr ) { $string =~ s/^\s//; print $string, "\n"; } prints: This has a leading space This does not The regular expression s/^\s//; means s/ # substitute ^ # at the beginning of the string \s

strip first space

2002-03-01 Thread Susan Aurand
If I have a string and the first character is a space, may not always be a space. Example: John Tommy Beth John and Beth have a space, Tommy does not. How do I strip that. I do not want to use the global command because a want the space between First and Last name.

RE: TIMTOWDI Was: RE: some questions about for, foreach

2002-03-01 Thread John Edwards
Yeah, yeah. So I made a typo. :p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 01 March 2002 18:00 To: [EMAIL PROTECTED] Subject: TIMTOWDI Was: RE: some questions about for, foreach It is really sad when people can't get their MLA (Multi-Letter Acronym) cor

Re: some questions about for, foreach

2002-03-01 Thread George Gunderson
On Friday, March 1, 2002, at 10:22 , John Edwards wrote: > I think it lies in the history of programming. Traditionally for loops > look > like this (when written in perl) > > for($i=1; $i<=100; $i++){ >print "$i\n"; > } One could write, as an alternative to for: $i=1; while ($i<=100) {

Re: TIMTOWDI Was: RE: some questions about for, foreach

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Brett W. McCoy wrote: > On Fri, 1 Mar 2002, Dennis G. Wicks wrote: > > > It is really sad when people can't get their MLA > > (Multi-Letter Acronym) correct! > > > > It should be TIMTOWTDI > > > > "There Is More Than One Way To Do It" > > I prefer Err, ignore that... I h

Re: TIMTOWDI Was: RE: some questions about for, foreach

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Dennis G. Wicks wrote: > It is really sad when people can't get their MLA > (Multi-Letter Acronym) correct! > > It should be TIMTOWTDI > > "There Is More Than One Way To Do It" I prefer http://www.chapelperilous.net/ -

RE: some questions about for, foreach

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Nikola Janceski wrote: > what the heck is TIMTOWDI? It's TMTOWTDI There's More Than One Way To Do It 00 pronounced like tim-toady. -- Brett http://www.chapelperilous.net/ -

TIMTOWDI Was: RE: some questions about for, foreach

2002-03-01 Thread Dennis G. Wicks
It is really sad when people can't get their MLA (Multi-Letter Acronym) correct! It should be TIMTOWTDI "There Is More Than One Way To Do It" which is the Perl Hackers motto. Good Luck! Dennis -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROT

RE: some questions about for, foreach

2002-03-01 Thread Nikola Janceski
what the heck is TIMTOWDI? I tried it at acronym finder and nothing.. http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=TIMTOWDI&Find =Find -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: Friday, March 01, 2002 10:22 AM To: 'Jon Molin'; [EMAIL PROTECT

Re: some questions about for, foreach

2002-03-01 Thread Jeff 'japhy' Pinyan
On Mar 1, Jon Molin said: >I've always thought there's a difference between for and foreach, that >for uses copies and foreach not. But there's no diff is there? >From perlsyn, "Foreach Loops": The foreach keyword is actually a synonym for the for keyword, so you can use for

Re: some questions about for, foreach

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Jon Molin wrote: > > It merely depends on your preferences, readable/maintanable code vs > > quick && dirty. > > if there's no difference, what's the point of having both? I can't see > how readable/maintanable would increase by adding functions with the > same name, it'd rath

RE: some questions about for, foreach

2002-03-01 Thread John Edwards
I think it lies in the history of programming. Traditionally for loops look like this (when written in perl) for($i=1; $i<=100; $i++){ print "$i\n"; } while foreach loops look like this. @array = qw(one two three); foreach (@array) { print "$_\n"; } Even though you can do for (@a

Re: some questions about for, foreach

2002-03-01 Thread Jeff 'japhy' Pinyan
On Mar 1, Jon Molin said: >Jan Gruber wrote: >> >> On Friday 01 March 2002 11:29 am, you wrote: >> > >> > I've always thought there's a difference between for and foreach, that >> > for uses copies and foreach not. But there's no diff is there? >> >> AFAIK there's not really a difference betwee

Re: Trouble with Net::Ping

2002-03-01 Thread Joseph Bajin
Hmmm. I tried putting in the icmp instead, but because I am not root I am unable to run it. I don't understand why I can ping it from the command line just fine but not in this program. Any more ideas. [EMAIL PROTECTED] wrote: >Try changing the line below to: > >$t = Net::Ping->new('icmp'); >

Re: Trouble with Net::Ping

2002-03-01 Thread Jan Gruber
Hi, Joseph && list ! On Friday 01 March 2002 02:44 pm, you wrote: > I am appearing to have some > troubles. It appears that it can not reach the hosts specified, but when I > try it manually it works just fine. # use TCP if we're not root, ICMP if we are my $pong = Net::Ping->new( $> ? ("tcp",

RE: Trouble with Net::Ping

2002-03-01 Thread Timothy Johnson
Try changing the line below to: $t = Net::Ping->new('icmp'); by default Net::Ping uses UDP packets, but not all hosts will respond to this. -Original Message- From: Joseph Bajin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 8:43 AM To: [EMAIL PROTECTED] Subject: Trouble

Re: some questions about for, foreach

2002-03-01 Thread Jon Molin
Jan Gruber wrote: > > Hi, Jon && list ! > On Friday 01 March 2002 11:29 am, you wrote: > > Hi list! > > > > I've always thought there's a difference between for and foreach, that > > for uses copies and foreach not. But there's no diff is there? > > AFAIK there's not really a difference between

Re: PERL2EXE || PERL2BIN

2002-03-01 Thread Jenda Krynicky
From: Roman Fordinal <[EMAIL PROTECTED]> > why i can compile PERL script under Linux to binnary? I think you meant "HOW" :-) I believe there is a Linux version of PerlApp from ActiveState See http://www.ActiveState.com , look for Perl Development Kit. You might also try perl

Trouble with Net::Ping

2002-03-01 Thread jbajin
I am appearing to have some troubles. It appears that it can not reach the hosts specified, but when I try it manually it works just fine. Here is what I have for my code: #!/usr/bin/perl -w use strict; use Net::Ping; Initalize Variables# my @hosts= qw(au)

PERL2EXE || PERL2BIN

2002-03-01 Thread Roman Fordinal
why i can compile PERL script under Linux to binnary? : :.. Roman Fordinal :.: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: appending to rows

2002-03-01 Thread Hanson, Robert
I would use the second approach. I would think that it would be better performance-wise, not to mention I always like to have a backup in case things don't work the way I expected. Alother thing you have to try to do is only read in as much data at one time as you need to, because a million rows

Re: return new hashref

2002-03-01 Thread Jan Gruber
Hi, Jenda ! - code snipped - Grr, i was playing around with eval and bless, but forgot the KISS ! Thx, Jan -- cat /dev/world | perl -e "while (<>) {(/(^.*? \?) 42 \!/) && (print $1)}" errors->(c) _ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECT

appending to rows

2002-03-01 Thread Ho, Tony
Hi guys I was wondering if you could help me I have 2 files. One file has 3 data rows, A, B and C The file has 1 data row D. I need to append row D to rows A and C in the first file, based on some condition. Any ideas how I could go about this ? Another alternative would be for me to open up

Re: return new hashref

2002-03-01 Thread Jenda Krynicky
From: Jan Gruber <[EMAIL PROTECTED]> > I'm trying to build a linked list, containing hashrefs. > Walking through the %HashRef (-x %HashRef) i can see a lot of > 'REUSED_ADDRESS'es in the list. At the end, all refs point to one > single adress, so every HashRef in my list points

return new hashref

2002-03-01 Thread Jan Gruber
Hi, List ! I'm trying to build a linked list, containing hashrefs. Walking through the %HashRef (-x %HashRef) i can see a lot of 'REUSED_ADDRESS'es in the list. At the end, all refs point to one single adress, so every HashRef in my list points to the same hash. I have considered trying the OO

Re: some questions about for, foreach

2002-03-01 Thread Jan Gruber
Hi, Jon && list ! On Friday 01 March 2002 11:29 am, you wrote: > Hi list! > > I've always thought there's a difference between for and foreach, that > for uses copies and foreach not. But there's no diff is there? AFAIK there's not really a difference between these two. It merely depends on you

Write statement ?

2002-03-01 Thread Grant $ Sandra Hansen
The problem lies in the second loop. Each time through the loop I am writing to a separate file, which appears to be working, the body of the report is in each file. The header is what I am having problems with. I want to change the page length so the header appears at the top of each file inste

some questions about for, foreach

2002-03-01 Thread Jon Molin
Hi list! I've always thought there's a difference between for and foreach, that for uses copies and foreach not. But there's no diff is there? my @a = (1, 2, 3 , 4 , 5); $_ += 2 for (@a); print "@a\n"; 3 4 5 6 7 my @a = (1, 2, 3 , 4 , 5); $_ += 2 foreach (@a); print "@a\n"; 3 4 5 6 7 why isn

RE: searching a large file

2002-03-01 Thread Kevin Cornmell
++ Please read the disclaimer at the bottom of this e-mail. ++ TMTOWTDI. I havent got my "Mastering regular Expressions Book" at hand, so Im sure the syntax is wrong, but you get the drift...