Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Perl's feature to determine, in current point of loop, that this is the last one? (updated)

by haukex (Archbishop)
on Jan 23, 2022 at 08:32 UTC ( [id://11140740]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
    while ( my $v = shift @array_copy ) {
        print $v, @array_copy ? ", " : ".\n";
    }
    
  2. or download this
    # demo of a basic iterator
    use Iterator::Simple 'iter';
    ...
    while (defined( my $v = $itp->() )) {
        print $v, defined $itp->peek ? ", " : ".\n";
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-19 19:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found