Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Test for the last element in a foreach (==\)

by tye (Sage)
on Aug 02, 2007 at 20:16 UTC ( [id://630384]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @array= ( 1..5 );
    for( @array ) {
    ...
    4
    Last element.
    5
    
  2. or download this
    my $five= 5;
    *array= sub { \@_ }->( 1, 2, $five, 4, $five );
    ...
    4
    Last element.
    5
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://630384]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2025-03-17 06:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (54 votes). Check out past polls.