for each

2005-10-07 Thread gustav
Hi there! How do I get a for each-statement to start at element 1 (second element) /G -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: for each

2005-10-07 Thread Wijaya Edward
- Original Message - From: [EMAIL PROTECTED] Date: Friday, October 7, 2005 3:29 pm Subject: for each > Hi there! > Hi! > How do I get a for each-statement to start at element 1 (second > element) $ perl -e ' @arr = qw (a b c); foreach(1 .. $#arr) { print "$arr[$_]\n"; }' prints:

Re: for each

2005-10-07 Thread gustav
Hi there! Yes, exactly. Thanx a lot! :-) /G > > > - Original Message - > From: [EMAIL PROTECTED] > Date: Friday, October 7, 2005 3:29 pm > Subject: for each > >> Hi there! >> > Hi! > >> How do I get a for each-statement to start at element 1 (second >> element) > > $ perl -e ' > @arr = q

RE: for each

2005-10-07 Thread Thomas Bätzler
Hi, [EMAIL PROTECTED] <[EMAIL PROTECTED]> asked: > How do I get a for each-statement to start at element 1 > (second element) # probably bad for long lists foreach my $item ( @list[1..$#list] ){ ... } # quick but destroys @list foreach my $item ( splice @list,1 ){ ... } Of course, you coul

Re: for each

2005-10-07 Thread Mark Sargent
$ perl -e ' @arr = qw (a b c); foreach(1 .. $#arr) { print "$arr[$_]\n"; }' prints: b c Is that what you want? -- Regards, Edward WIJAYA SINGAPORE Hi All, Edward, for a beginner, would you mind explaining what the (1 .. $#arr) and qw actually do in this code.? Cheers Mark Sarg

Re: for each

2005-10-07 Thread Wijaya Edward
Hi Mark, > > > > Edward, for a beginner, would you mind explaining what the >(1 .. $#arr) $#arr is the index of the last element in the array > and qw actually do in this code.? Cheers with "qw" you are treating values inside as individual words automatically. Thus you don't need to put quo

RE: for each

2005-10-07 Thread Thomas Bätzler
Mark Sargent <[EMAIL PROTECTED]> asked: > >>$ perl -e ' > >>@arr = qw (a b c); > >> foreach(1 .. $#arr) > >>{ > >> print "$arr[$_]\n"; > >>}' > Edward, for a beginner, would you mind explaining what the (1 > .. $#arr) and qw actually do in this code.? Cheers I'm not Edward, but I'll give it a

Re: for each

2005-10-07 Thread Mark Sargent
Wijaya Edward wrote: Hi Mark, Edward, for a beginner, would you mind explaining what the >(1 .. $#arr) $#arr is the index of the last element in the array ok, so 1 .. $#arr is the same as 1 .. 2 where 2 is the index of b, yes..? and qw actually do in this code.? Cheers

problem with GD

2005-10-07 Thread Aditi Gupta
Hello everybody, I've tried installing GD for Activestate Perl on a Windows XP system. I've downloaded the module from CPAN. But the module contains GD.xs file and hence I've to build it myself. I used C compiler but it is giving many errors and most of them are not being able to locate perl.h, ex

Re: problem with GD

2005-10-07 Thread Dan Klose
On Fri, 2005-10-07 at 03:55 -0700, Aditi Gupta wrote: > Hello everybody, > I've tried installing GD for Activestate Perl on a Windows XP system. I've > downloaded the module from CPAN. But the module contains GD.xs file and > hence I've to build it myself. I used C compiler but it is giving many >

Skipping blank lines while reading a flat file.

2005-10-07 Thread Dave Thacker
Perl 5.6 on linux Given this test file. --start- this is my file end-- I want to skip the blank lines and just print the lines with text, like this this is myfile This is my test case code. #!/usr/bin/perl -w use strict; my $opt_testfile="test-text.txt"; open (TS

Re: Skipping blank lines while reading a flat file.

2005-10-07 Thread Alois Heuboeck
Dave, (this is one I know :-) ) I want to skip the blank lines and just print the lines with text, like this this is myfile This is my test case code. #!/usr/bin/perl -w use strict; my $opt_testfile="test-text.txt"; open (TS, $opt_testfile) or die "can't open file"; while () { chomp;

Re: Skipping blank lines while reading a flat file.

2005-10-07 Thread John W. Krahn
Dave Thacker wrote: > Perl 5.6 on linux > > Given this test file. > --start- > this > > is > > my file > end-- > I want to skip the blank lines and just print the lines with text, like this > this > is > myfile > > This is my test case code. > #!/usr/bin/perl -w >

RE: Skipping blank lines while reading a flat file.

2005-10-07 Thread Ron Goral
> -Original Message- > From: Dave Thacker [mailto:[EMAIL PROTECTED] > Sent: Friday, October 07, 2005 07:05 > To: beginners@perl.org > Subject: Skipping blank lines while reading a flat file. > > > Perl 5.6 on linux > > Given this test file. > --start- > this > > is > > m

Re: Skipping blank lines while reading a flat file.

2005-10-07 Thread Jeff 'japhy' Pinyan
On Oct 7, Dave Thacker said: Given this test file. --start- this is my file end-- I want to skip the blank lines and just print the lines with text, like this When you say "blank", do you mean lines with NO characters at all (other than the ending newline) or lin

Finding directories within a tree

2005-10-07 Thread jason_normandin
Good Afternoon I am attempting to develop a script that will parse a directory listing and return only directory names that match a given expression. It would make sense to me to use File::Find to do this but based on the dir structure I am parsing, the amount of overhead to do this is enourmou

RE: Finding directories within a tree

2005-10-07 Thread Larsen, Errin M HMMA/IT
[EMAIL PROTECTED] wrote: > Good Afternoon > > I am attempting to develop a script that will parse a directory > listing and return only directory names that match a given > expression. > > It would make sense to me to use File::Find to do this but based on > the dir structure I am parsing, the

Re: Finding directories within a tree

2005-10-07 Thread Adriano Ferreira
On 10/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Basically, I have a file structure similar to: > > Dir1\Dir2\Support\119404\dirx\diry > Dir1\Dir3\Support\119893\dirx > Dir1\Dir4\Support\14\dirx\diry\dirz > . > Dir1\Dir1000\Support\100858 > > I am simply interested in finding the

Re: Finding directories within a tree

2005-10-07 Thread Gustav Wiberg
Hi there! Isn't it possible to use dir - command? (dos-command) which is similar to ls /G - Original Message - From: <[EMAIL PROTECTED]> To: Sent: Friday, October 07, 2005 7:17 PM Subject: Finding directories within a tree Good Afternoon I am attempting to develop a script that wi

Re: Finding directories within a tree

2005-10-07 Thread rangerrickca
I am receiving numerous amounts of mail but have not filled out any questionnaires giving away any sort of information. If these letters continue being sent to me I will be forced to report you to AOL as spam and possibly other forms to get me taken off of whatever list that I am on. PLEASE take

Redirecting STDERR

2005-10-07 Thread Ryan Frantz
Perlers, I have a script where I redirect STDERR to a file so that I can capture 'die' messages like so: use warnings; use strict; my $logfile = "/some/path/logfile.txt"; open STDERR, ">>$logfile"; something or die "Unable to do something()\n"; close STDERR; Is it kosher to do this? Or is t

Re: Finding directories within a tree

2005-10-07 Thread Dave Gray
On 10/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I am receiving numerous amounts of mail but have not filled out any > questionnaires giving away any sort of information. If these letters continue > being sent to me I will be forced to report you to AOL as spam and possibly > other for

Re: RE: Finding directories within a tree

2005-10-07 Thread jason_normandin
That worked perfectley. > > From: "Larsen, Errin M HMMA/IT" <[EMAIL PROTECTED]> > Date: 2005/10/07 Fri PM 02:03:29 EDT > To: > Subject: RE: Finding directories within a tree > > [EMAIL PROTECTED] wrote: > > Good Afternoon > > > > I am attempting to develop a script that will parse a directory

Re: Finding directories within a tree

2005-10-07 Thread Dave Gray
On 10/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Good Afternoon > > I am attempting to develop a script that will parse a directory listing and > return only directory names that match a given expression. > > It would make sense to me to use File::Find to do this but based on the dir >

RE: Redirecting STDERR

2005-10-07 Thread Timothy Johnson
It partly depends on your operating system, I think. That's fine on Windows, but on UNIX I think that under some if not all circumstances your change will persist after the script finishes executing. I've never had to do it, but I've seen one method that goes like this: open(OLD_STDERR,">&STDERR

Re: Redirecting STDERR

2005-10-07 Thread Jeff Pan
hi, maybe u should redefined the __DIE__ handle for the reason of safety. such as: $SIG{__DIE__}=\&log_die; sub log_die { open (HDW,">>",$err_log); select HDW;$|=1;select STDOUT; print HDW @_; close HDW; die @_; } 2005/10/8, Timothy Johnson <[EMAIL PROTECTED]>: > It partly de

Re: Redirecting STDERR

2005-10-07 Thread Stephen Kratzer
Opening the filehandle STDERR to a file will not persist beyond termination of the script, nor will it affect other programs running at the same time as the script. It affects only the running script. STDERR of the shell is different from that of perl. On Friday 07 October 2005 16:56, Timothy J

finding an lement in an array

2005-10-07 Thread Jabir Ahmed
Hello I have a pretty simple problem ex: @a=qw( 1 2 3 4 5 6 7 ); $b=5; now i just want to check if the value of $b i.e 5 exists in the array @a or not Q 1) is there any way other than looping through the array? Q2 ) is there any predefined function to check the existance of the element in the

finding an lement in an array

2005-10-07 Thread Jabir Ahmed
Hello everyone, I have a pretty simple problem example : @a=qw( 1 2 3 4 5 6 7 ); $b=5; now i just want to check if the value of $b i.e 5 exists in the array @a or not Q 1) is there any way other than looping through the array? Q2 ) is there any predefined function to check the existance of t

finding an lement in an array

2005-10-07 Thread Mulander
2005/10/8, Jabir Ahmed <[EMAIL PROTECTED]>: > Hello everyone, > > I have a pretty simple problem > > example : > > @a=qw( 1 2 3 4 5 6 7 ); > $b=5; > > now i just want to check if the value of $b i.e 5 > exists in the array @a or not > > Q 1) is there any way other than looping through the > array?