in reply to Embedding a bash funtion in perl script
You can store the definition in a Perl variable, though, and prepend it to any code that needs to use it (note that backquotes interpolate variables):
my $f = 'forloop () { for ((a=1;a<=5;a++)) ; do var="$a" echo "$var" done }'; my $result=`$f; forloop`; print $result;
Nevertheless, usually implementing the whole logic in Perl might get you the clearest code.
|
---|