This produced the output:use strict; use IPC::Open3; my @plist = ("ABC","DEF","GHI"); print "plist Before ccmexec:\n============\n",join("\n",@plist),"\n=== +=========\n\n"; my $ccmexecResult; foreach( @plist){ $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; }
plist Before ccmexec: ============ ABC DEF GHI ============ ccmexec returned: HelloWorld plist After ccmexec: ============ DEF GHI ============ ccmexec returned: HelloWorld plist After ccmexec: ============ GHI ============ ccmexec returned: HelloWorld plist After ccmexec: ============ ============
In reply to Re^2: Why are elements of my array getting deleted?
by iKnowNothing
in thread Why are elements of my array getting deleted?
by iKnowNothing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |