in reply to Re: Why are elements of my array getting deleted?
in thread Why are elements of my array getting deleted?
use strict; use IPC::Open3; my @plist = ("ABC","DEF","GHI"); print "plist Before ccmexec:\n============\n",join("\n",@plist),"\n=== +=========\n\n"; my $ccmexecResult; my $idx = 0; for ($idx = 0; $idx <= $#plist;$idx++){ $ccmexecResult = ccmexec_nodie("echo HelloWorld"); print "ccmexec returned: $ccmexecResult\n"; print "plist After ccmexec:\n============\n",join("\n",@plist),"\n +============\n\n"; } sub ccmexec_nodie { my $command = $_[0]; my ($mystdin,$mystdout,$mystderr); my $pid = open3($mystdin,$mystdout,$mystderr,$command); my $myresult = ""; while(<$mystdout>){ $myresult = "$myresult$_"; } return $myresult; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Why are elements of my array getting deleted?
by GrandFather (Saint) on Apr 19, 2012 at 01:02 UTC |