[Melbourne-pm] Simple(?) question involving backticks and die
Benji Wakely
benji at arsimagica.net
Wed Jan 4 20:56:57 PST 2006
Greetings all.
I'm confused by this behaviour...
When I look at the two lines of code:
my @list = `/bin/ls /home` || die ("Couldn't list files");
die ("Couldn't list files") unless my @list = `/bin/ls /home`;
they to be equivalent to me.
The perl interpreter begs to differ, however, because:
The first invocation generates:
$list[0] = "alfred betty charlie"
and the second invocation fills the list up one element at a time,
eg.
$list[0] = "alfred";
$list[1] = "betty";
$list[2] = "charlie";
...I was just curious to know what actually causes this
difference in behaviour.
Any takers?
--
Benji Wakely
+614 0958 8566
benji at arsimagica.net
More information about the Melbourne-pm
mailing list