Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: split problem

by Marshall (Canon)
on Nov 29, 2016 at 22:43 UTC ( [id://1176866]=note: print w/replies, xml ) Need Help??


in reply to split problem

Please explain further what you intend to accomplish as an end result. Your code is actually fine albeit strange.
use strict; use warnings; use Data::Dumper; my $value = "A\tB\tC\tD\tE\tF\t\t\t\t"; my @flds; @flds = split(/\t/,$value); $flds[16] = undef; $flds[8] = 0; print Dumper \@flds; __END__ $VAR1 = [ 'A', 'B', 'C', 'D', 'E', 'F', undef, undef, 0, undef, undef, undef, undef, undef, undef, undef, undef ];
PS: I see other replies, I am using Perl 5.20 Could be a bug.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-29 21:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found