in reply to How to create array from file
#!/usr/bin/perl use strict; use warnings; use Scalar::Util qw{ looks_like_number }; use Test::More tests => 1; *ARGV = *DATA{IO}; my $expected = [ ['1,2,\'hello\',\'aerf\''], ['1,2,\'hello\',\'aerf\''], ['1,2,\'hello\',\'aerf\''], ['1,2,\'hello\',\'aerf\''], ['1,2,\'hello\',\'aerf\''], ['1,2,\'hello\',\'aerf\''] ]; my $result = [ map [ join ",", map looks_like_number($_) ? $_ : "'$_'", split " " ], <> ]; is_deeply $result, $expected, 'same'; __DATA__ 1 2 hello aerf 1 2 hello aerf 1 2 hello aerf 1 2 hello aerf 1 2 hello aerf 1 2 hello aerf
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to create array from file
by Mjpaddy (Acolyte) on Jan 20, 2017 at 13:09 UTC | |
by Corion (Patriarch) on Jan 20, 2017 at 13:11 UTC | |
by choroba (Cardinal) on Jan 20, 2017 at 13:35 UTC | |
by AnomalousMonk (Archbishop) on Jan 20, 2017 at 20:02 UTC |