in reply to Re: Creating an array from a text file
in thread Creating an array from a text file

Well, heck, if we're going to go down the road of confusing the person, we can make each individual line an array ref of elements split on predetermined separators :)

#!/usr/bin/perl -w use strict; use Data::Dumper; $_ = [ grep {$_} split /[\s,:]/ ] for my @data = <DATA>; print Dumper \@data; __DATA__ foo bar, baz this that: those

Note: that was tongue-in-cheek, but I can see that point that Abigail-II made.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.