apotheon has asked for the wisdom of the Perl Monks concerning the following question:
I have a nice, simple question, though the answer may not be as simple. I really don't know. First, two code snippets.
Snippet one:
exec('/etc/init.d/networking restart');
Snippet two:
my $output = `/etc/init.d/networking restart`; print $output;
So, with those in mind -- why does the backtick version take an age and a half to run, while the /etc/init.d/networking restart that picks up where exec() left off is pretty much instantaneous? I don't imagine the assignment can be taking that long, though I suppose I could for some reason be mistaken in such an assumption.
|
- apotheon
CopyWrite Chad Perrin |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: exec vs. backtick-and-assign performance
by Joost (Canon) on Nov 12, 2006 at 11:05 UTC | |
by apotheon (Deacon) on Nov 12, 2006 at 21:38 UTC | |
by Joost (Canon) on Nov 12, 2006 at 22:42 UTC | |
by apotheon (Deacon) on Nov 12, 2006 at 23:48 UTC | |
by Joost (Canon) on Nov 13, 2006 at 00:08 UTC | |
| |
|
Re: exec vs. backtick-and-assign performance
by jwkrahn (Abbot) on Nov 12, 2006 at 09:18 UTC | |
|
Re: exec vs. backtick-and-assign performance
by sgifford (Prior) on Nov 13, 2006 at 03:41 UTC |