Re: Newbie that needs some help

2004-02-22 Thread John W. Krahn
Perl Mail User wrote: > > Hello All, Hello, > I have a basic question, I am new to perl, and I would like to try > and get a basic question answered, if possible. I have a file with > about 63 lines in it, I am running it through a basic perl program > that reads every line and prints it to the

Re: Newbie that needs some help

2004-02-22 Thread John W. Krahn
Owen wrote: > > On Sat, 21 Feb 2004 21:23:13 -0600 > Perl Mail User <[EMAIL PROTECTED]> wrote: > > I think you need to change > > > foreach ($line) { > > @lines = $line; > > to > > push(@lines,$line); > > Your foreach loop is in the inner most loop, so your @lines is only

RE: parsing Makefiles

2004-02-22 Thread David le Blanc
> From: Andrew Gaffney [mailto:[EMAIL PROTECTED] > Sent: Sunday, 22 February 2004 6:09 PM > To: David le Blanc > Cc: [EMAIL PROTECTED] > Subject: Re: parsing Makefiles > > David le Blanc wrote: > >>I've come up with some *simple* code that seems to work: > >> > >>#!/usr/bin/perl > >> > >>use stri

converting array to hash

2004-02-22 Thread Anthony Vanelverdinghe
Hi Could anyone explain why the output of the hash isn't: 1 a 2 b 3 c How can i make that the order remains

Re: Checking about gif

2004-02-22 Thread John
Hehe, MAC OS your script seems to be working perfectly. Thank you for your help! - Original Message - From: "MAC OS [EMAIL PROTECTED]" <[EMAIL PROTECTED]> To: "John" <[EMAIL PROTECTED]> Cc: "Perl Beginners" <[EMAIL PROTECTED]> Sent: Saturday, February 21, 2004 10:10 PM Subject: Re: Chec

Re: Checking about gif

2004-02-22 Thread John
Undoubtedly, you script also work but i think with MMagic you can do the same thing with much less effort. - Original Message - From: "R. Joseph Newton" <[EMAIL PROTECTED]> To: "John" <[EMAIL PROTECTED]> Cc: "Perl Beginners" <[EMAIL PROTECTED]> Sent: Sunday, February 22, 2004 1:07 AM Sub

Re: parsing Makefiles

2004-02-22 Thread Andrew Gaffney
David le Blanc wrote: From: Andrew Gaffney [mailto:[EMAIL PROTECTED] Sent: Sunday, 22 February 2004 6:09 PM To: David le Blanc Cc: [EMAIL PROTECTED] Subject: Re: parsing Makefiles David le Blanc wrote: I've come up with some *simple* code that seems to work: #!/usr/bin/perl use strict; use war

Re: converting array to hash

2004-02-22 Thread John McKown
On Sun, 22 Feb 2004, Anthony Vanelverdinghe wrote: > Hi > > Could anyone explain why the output of the hash isn't: 1 a > >2 b >

Re: converting array to hash

2004-02-22 Thread Andrew Gaffney
Anthony Vanelverdinghe wrote: Hi Could anyone explain why the output of the hash isn't: 1 a 2 b 3 c How can

Re: Checking about gif

2004-02-22 Thread MAC OS X
#!/usr/bin/perl -w use strict; die "Usage: $0 directory\n" unless @ARGV > 0; use File::Find; use File::MMagic; my $mm = File::MMagic->new; find sub { return if -d $_ or -l $_; my $type = $mm->checktype_filename($_); return unless $type =~ /gif/i; print "$File::Find::name: $t

Re: Make file jobs

2004-02-22 Thread Jenda Krynicky
From: "stephen kelly" <[EMAIL PROTECTED]> > i work in the localisation industry - silly me and am automating a lot > of our repititive jobs - we use a lot of regular expressions so i was > told to use perl to automate. Silly question - can i run system > commands to interact with our sourcesafe dat

struct as an argument of a function

2004-02-22 Thread Öznur Taştan
Hi, I am trying to use struct as an argument of a function. In the piece of code I try to use $t as a parameter of the print_usage function but it gives the error: Can't call method "ru_stime" without a package or object reference at str.txt l ne 28. Could anyone explain what is wrong? thanks oz

struct as an argument of a function

2004-02-22 Thread Öznur Taştan
Hi, I am trying to use struct as an argument of a function. In the piece of code I try to use $t as a parameter of the print_usage function but it gives the error: Can't call method "ru_stime" without a package or object reference at str.txt l ne 28. Could anyone explain what is wrong? thanks oz

Re: struct as an argument of a function

2004-02-22 Thread R. Joseph Newton
Öznur Taþtan wrote: > Hi, > I am trying to use struct as an argument of a function. > In the piece of code I try to use $t as a parameter of the print_usage function but > it gives the error: > > Can't call method "ru_stime" without a package or object reference at str.txt l > ne 28. > > Could an

Re: struct as an argument of a function

2004-02-22 Thread Öznur Tastan
> Öznur Taþtan wrote: > > > Hi, > > I am trying to use struct as an argument of a function. > > In the piece of code I try to use $t as a parameter of the print_usage function but > > it gives the error: > > > > Can't call method "ru_stime" without a package or object reference at str.txt l >

Re: struct as an argument of a function

2004-02-22 Thread Rob Dixon
Öznur tastan wrote: > > I am trying to use struct as an argument of a function. > In the piece of code I try to use $t as a parameter of the print_usage function but > it gives the error: > > Can't call method "ru_stime" without a package or object reference at str.txt l > ne 28. > > Could anyone

Help with end of line charaters

2004-02-22 Thread Westcott Andrew-AWESTCO1
Hi, I'm new to perl but need to write a script that takes a file and formats lines. The file has to 2 fields that are tab separated and each field is made up of items separated by some type of linefeed character. The end of the second field is identified by another type of linefeed character.

sleep under windows cmd

2004-02-22 Thread daniel
Hi helpers, I'm very new in perl programming(in programming at all acutally) and wondering about the following piece of code which I was running under W2K command-line: print "First"; sleep 2; print "Second"; I thought the script would print First then wait for 2 seconds and than print Second. Bu

Re: sleep under windows cmd

2004-02-22 Thread WilliamGunther
$| = 1; #Autoflush print "First"; sleep 2; print "Second"; -Will --- Handy Yet Cryptic Code. Just to Look Cool to Look at and try to decipher without running it. Windows perl -e "printf qq.%3i\x20\x3d\x20\x27%c\x27\x09.,$_,$_ for 0x20..0x7e" Unix perl -e 'printf

Re: sleep under windows cmd

2004-02-22 Thread Randy W. Sims
On 02/22/04 05:09, daniel wrote: Hi helpers, I'm very new in perl programming(in programming at all acutally) and wondering about the following piece of code which I was running under W2K command-line: print "First"; sleep 2; print "Second"; I thought the script would print First then wait for 2 s

Network Sniffer Module

2004-02-22 Thread Jason Normandin
Hi List. I am looking for a module that will allow me to perform the same function as the Solaris snoop command via Perl. I have searched CPAN, but was unable to find such a module. I would rather not use the snoop command itself, hence my module query. Anyone know if there is one out t

Re: Network Sniffer Module

2004-02-22 Thread Kenton Brede
On Sun, Feb 22, 2004 at 05:59:43PM -0500, Jason Normandin ([EMAIL PROTECTED]) wrote: > Hi List. > I am looking for a module that will allow me to perform the same function as > the Solaris snoop command via Perl. I have searched CPAN, but was unable to > > I would rather not use the snoop command

RE: Help with end of line charaters

2004-02-22 Thread David le Blanc
> From: Westcott Andrew-AWESTCO1 [mailto:[EMAIL PROTECTED] > Sent: Sunday, 22 February 2004 10:08 PM > To: '[EMAIL PROTECTED]' > Subject: Help with end of line charaters > > Hi, > > I'm new to perl but need to write a script that takes a file > and formats > lines. > > The file has to 2 fiel

RE: parsing Makefiles

2004-02-22 Thread David le Blanc
> From: Andrew Gaffney [mailto:[EMAIL PROTECTED] > Sent: Monday, 23 February 2004 12:35 AM > To: David le Blanc > Cc: [EMAIL PROTECTED] > Subject: Re: parsing Makefiles > > David le Blanc wrote: > >>From: Andrew Gaffney [mailto:[EMAIL PROTECTED] > >>Sent: Sunday, 22 February 2004 6:09 PM > >>To:

Re: struct as an argument of a function

2004-02-22 Thread R. Joseph Newton
Öznur Tastan wrote: > > > &print_rusage($t); > > > > Don't do this. The & operator is needed only in special cicumstances > > I was wondering when to use this &? Not very often, really. I used it recently, and I think that was the first time in many thousands of function calls. On place it

RE: Network Sniffer Module

2004-02-22 Thread David le Blanc
> -Original Message- > From: Kenton Brede [mailto:[EMAIL PROTECTED] > Sent: Monday, 23 February 2004 11:52 AM > To: Perl Beginners > Subject: Re: Network Sniffer Module > > On Sun, Feb 22, 2004 at 05:59:43PM -0500, Jason Normandin > ([EMAIL PROTECTED]) wrote: > > Hi List. > > I am lookin

RE: Network Sniffer Module

2004-02-22 Thread David le Blanc
> There has to be a module that does this already!!! Isn't there? Please? > I can't find one! Well bugger me. I just found Netpacket on cpan. NetPacket modules to assemble/disassemble network packets at the protocol level. NetPacket-0.04 - 21 May 2003 - Stephanie Wehner > If there isn't

RE: struct as an argument of a function

2004-02-22 Thread David le Blanc
> > I was wondering when to use this &? > > Not very often, really. I used it recently, and I think that > was the first time > in many thousands of function calls. On place it is necessary is when > dereferencing a function ref [or it could be that I just > haven't found a way to > accomplish

Re: Help with end of line charaters

2004-02-22 Thread R. Joseph Newton
Westcott Andrew-AWESTCO1 wrote: > Hi, > > I'm new to perl but need to write a script that takes a file and formats > lines. > > The file has to 2 fields that are tab separated and each field is made up of > items separated by some type of linefeed character. The end of the second > field is identi

Re: struct as an argument of a function

2004-02-22 Thread R. Joseph Newton
David le Blanc wrote: > On [sic] place it is necessary is when > > dereferencing a function ref [or it could be that I just > > haven't found a way to > > accomplish that task without it.] ... > > $coderef->(); Coolness. ... or shall I say "duh"? So--any examples of where the & *would*

newbie question about chomp...

2004-02-22 Thread R i c a r d o P i c h l e r
Hi people, i don Ricardo Pichler -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

newbie question about chomp...

2004-02-22 Thread R i c a r d o P i c h l e r
Hi people, I can't make this work... foreach $input() { chomp $input; print "$input\n"; } But with this, I do... foreach $input() { $input =~ s/\n//; $input =~ s/\r//; print "$input\n"; } In first example, print two new line, in second work fine printing one new line. Why f

Re: newbie question about chomp...

2004-02-22 Thread WC -Sx- Jones
=pod ( R i c a r d o P i c h l e r ) wrote: Hi people, I can't make this work... foreach $input() { chomp $input; print "$input\n"; } =cut # hopefully it was previously opened. while() { chomp; s/^\s//; s/\s$//; print "$_"; } __END__ All this was asked and answered many times; p