Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Avoiding vivification with array slice

by jbert (Priest)
on Sep 09, 2008 at 12:37 UTC ( [id://710067]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    print "After assign from: " . Dumper(\@a);
    @b = grep { defined $_ } @a[0..5];
    print "After grep over: " . Dumper(\@a); # Didn't expect the undef's
    
  2. or download this
    my @b = @a[0..N-1];
    foreach my $val (@b) {
       ....
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://710067]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2024-04-25 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found