develooper Front page | perl.beginners | Postings from February 2002

Re: Accessing previous element of an array in a 'foreach' loop

Thread Previous | Thread Next
From:
Brett W. McCoy
Date:
February 6, 2002 14:15
Subject:
Re: Accessing previous element of an array in a 'foreach' loop
Message ID:
Pine.LNX.4.43.0202061721130.17062-100000@chapelperilous.net
On Wed, 6 Feb 2002, Jeff 'japhy' Pinyan wrote:

> Err, no.  $_ is STILL an alias.
>
>   my @words = qw( once upon a time );
>   length > 1 and $_ = ucfirst($_) for @words;
>   print "@words";  # Once Upon a Time

argh, yeah.  I was thinking backwards.  Thanks for pointing that out.

-- Brett
                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
We must die because we have known them.
		-- Ptah-hotep, 2000 B.C.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About