Here's a bit of Perl code that does what I want:
my $value = get_value();
my $result = qx(some-shell-command $value);
sub get_value {
...
return ...
}
Is it possible to achieve the same effect without using $value
? Something like
my $result = qx (some-shell-command . ' '. get_value());
I know why the second approach doesn't work, it's just to demonstrate the idea.
but I would rather use your first option.
Explanation: perl arrays interpolate inside
""
,qx()
, etc.Above is array reference
[]
holding result of function, being dereferenced by@{}
, and interpolated insideqx()
.