Sounds like a job for coderefs.
#!/usr/bin/env perl use strict; use warnings; sub myrun { print "Yeah, just printing @_\n"; } sub mysystem { system @_; } for (0..6) { my $run = $_ % 2 ? \&mysystem : \&myrun; $run->("echo Number $_"); }
did not work like bash do
You'll have to give more detail here. An SSCCE would be good.
🦛
In reply to Re: how to assign 'system' to a value, and eval it.
by hippo
in thread SOLVED:how to assign 'system' to a value, and eval it.
by vincentaxhe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |