Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: how to get out data of a hash?

by choroba (Archbishop)
on Apr 17, 2018 at 11:26 UTC ( #1213056=note: print w/replies, xml ) Need Help??


in reply to how to get out data of a hash?

Why?

Concatenation (.) forces scalar context. Arrays in scalar context return their size.

How?

You can either use join:
$tmp = "paste -d';' " . join(' ', @{ $csvheader{x_} }) . ' > all.x.txt +';

or just double quote the array, its members will be separated by $" which is a space by default:

$tmp = "paste -d';' @{ $csvheader{x_} } > all.x.txt";

Alternative

Instead of using paste, use Text::CSV_XS to process your CSV files. It handles quoted fields, escaped separators and quotes, and more.

($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 get out data of a hash?
by blaui (Initiate) on Apr 18, 2018 at 07:05 UTC
    Thanx a lot. :)
Re^2: how to get out data of a hash?
by Anonymous Monk on Apr 17, 2018 at 13:02 UTC
    "CPAN is your bestest friend." There you will find fast, thoroughly-tested modules for correctly handling all kinds of files and formats JSON, XML, CSV, you name it. "There's more than one way to do it," but "the best way to do it" is always to "let somebody else do it for you." Just use their module, knowing that it is known to work correctly in all cases.

      'but "the best way to do it" is always to "let somebody else do it for you." Just use their module, knowing that it is known to work correctly in all cases.'

      Not sure if this is sarcasm, but bugs are found, reported and patched in CPAN modules all the time. Letting someone else do it for you, without understanding how things work and what they actually do can hardly be described as 'the best way'.

        It's not sarcasm. It's you know who offering a sincere and oft repeated—and oft corrected—opinion.

      A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2020-10-22 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (225 votes). Check out past polls.

    Notices?