1

Using the Perl split() command to parse the output from the `du' command

view story
linux-howto

http://stackoverflow.com – I have a Perl script that has the following snippet in it: @mylittlearray = split(/\/dir1\/dir2\//, `du --max-depth=1 \/dir1\/dir2\//` print $mylittlearray[0]; print $mylittlearray[1]; print "\n"; The output is 24 ones 8 mylittlearray[0] and [1] should be returning only 24 and "ones", not "ones8". If I pipe the du command to a file and turn on set list in VIM I see the following: 24^I./ones$ 8^I./twos$ If I run the du command with a -0, I see this: 24 ./ones^@8 ./twos^@8 ./threes^@8 ./fours^@8 ./fives^@80 .^@ I'm trying to figure out how to split (HowTos)