Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: running programs

by arturo (Vicar)
on Aug 28, 2001 at 23:08 UTC ( [id://108554]=note: print w/replies, xml ) Need Help??


in reply to running programs

Take a look at the man pages for system and backticks ``

Backticks are useful if you want to capture the output of the external program.

my $output = `/home/mailman/bin/add_members -n/home/mailman/lists/minl +ist-news/email.out -wy minlist-news` or die "Cant' add members: $!\n" +;

The or die part is important -- it will be called if something goes wrong with the external program.

An alternative to backticks is system, just system "command", which is more useful when you don't need to capture the output and/or when you want more security (it's dangerous to put user input into any call that's going to get executed on your system).

HTH!

perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://108554]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-03-29 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found