Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl System Calls

Reply
Thread Tools

Perl System Calls

 
 
tweetiebirds@gmail.com
Guest
Posts: n/a
 
      05-13-2005
I know 2. saves the output from the system call, but if I don't care
about the output which is a better solution? :


1. system ("tar -xvf file.tar");


or



2. $untar = `tar -xvf file.tar`;



(or
3. I guess, use a tar module from CPAN )

T.

 
Reply With Quote
 
 
 
 
Sherm Pendley
Guest
Posts: n/a
 
      05-13-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I know 2. saves the output from the system call, but if I don't care
> about the output which is a better solution? :
>
>
> 1. system ("tar -xvf file.tar");


Why are you asking tar to produce output you don't care about?

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
 
 
 
tweetiebirds@gmail.com
Guest
Posts: n/a
 
      05-13-2005
I wouldn't, I would use system but was wondering which was more
'efficient' from a speed standpoint. thanks

 
Reply With Quote
 
Arndt Jonasson
Guest
Posts: n/a
 
      05-13-2005

(E-Mail Removed) writes:
> I wouldn't, I would use system but was wondering which was more
> 'efficient' from a speed standpoint. thanks


You wouldn't what?

You didn't mention speed in the original question, only "better".
The answer here is that it doesn't matter - what 'tar' does will
greatly outweigh the effort of calling it.
 
Reply With Quote
 
tweetiebirds@gmail.com
Guest
Posts: n/a
 
      05-13-2005
save the output in a variable.
when i execute system the normal tar output will go to standard out in
my shell which is all i want. thanks

 
Reply With Quote
 
Sherm Pendley
Guest
Posts: n/a
 
      05-13-2005
(E-Mail Removed) wrote:
> save the output in a variable.


What output? What variable?

Please quote some context in your messages. Have you read the posting
guidelines that appear here frequently?

> when i execute system the normal tar output will go to standard out in
> my shell which is all i want.


Okay, system() does what you want. What's the question then?

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
tweetiebirds@gmail.com
Guest
Posts: n/a
 
      05-13-2005
Ok I'll read up on it. (guidelines)

System does what i wat - I just wondered if it's the wise thing to use
in this example, to do what I want. thanks

 
Reply With Quote
 
Big and Blue
Guest
Posts: n/a
 
      05-13-2005
(E-Mail Removed) wrote:
> I know 2. saves the output from the system call, but if I don't care
> about the output which is a better solution? :
>
> 1. system ("tar -xvf file.tar");
>
> or
>
> 2. $untar = `tar -xvf file.tar`;


Neither really.

system qw( tar -xvf file.tar );

will ensure you remember it is possible to avoid involving a shell in cases
where you don't want to (although in this case it won't make much runtime
difference).



--
Just because I've written it doesn't mean that
either you or I have to believe it.
 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      05-13-2005
(E-Mail Removed) wrote in news:1116006919.872951.102920
@g47g2000cwa.googlegroups.com:

> Ok I'll read up on it. (guidelines)


One can only hope.

Sinan
 
Reply With Quote
 
Joe Smith
Guest
Posts: n/a
 
      05-15-2005
(E-Mail Removed) wrote:
> I wouldn't, I would use system but was wondering which was more
> 'efficient' from a speed standpoint.


It's *not* as speed issue.

$dummy = `program_that_creates_many_megabytes_of_output`;
system "program_that_creates_many_megabytes_of_output >/dev/null";

One uses up many megabytes of memory needlessly, the other doesn't.
-Joe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are system calls sometimes costlier than library calls? Richard Tobin C Programming 24 11-11-2007 08:52 AM
No execution of system calls in cygwin-perl after update boltz@gmx.de Perl Misc 0 08-24-2006 08:22 PM
system calls (mv + grep) within Perl script William Perl Misc 13 01-07-2006 02:39 PM
MoVoIP - FREE MOBILE Inetrnet Phone Calls - FREE Internet Phone Calls ubifone VOIP 0 07-29-2005 04:31 PM
How to determine available system calls on a Unix/Linux system markus C Programming 22 09-22-2004 10:32 PM



Advertisments