Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: split problem

by Marshall (Canon)
on Nov 29, 2016 at 22:43 UTC ( #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 examining the Monastery: (7)
As of 2023-12-04 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (25 votes). Check out past polls.

    Notices?