CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
system command

 



DanSandberg
Novice

Oct 31, 2008, 8:09 AM

Post #1 of 2 (324 views)
system command Can't Post

I'm very new to perl and I'm trying to write a script that runs a simulation. The shell command to run the simulation is 'mp' followed by the input filename. My perl program looks like:

Code
#! /usr/bin/perl 
$filein=$ARGV[0];
system 'nohup mp $filein &';

when I run this nothing happens. However, if I replace $filein with the explicit name of the input file then the program works fine. Why doesn't it work when the first argument is a a variable?


FishMonger
Veteran / Moderator

Oct 31, 2008, 8:41 AM

Post #2 of 2 (322 views)
Re: [DanSandberg] system command [In reply to] Can't Post

Using single quotes doesn't allow for variable interpolation. You need to use double quotes.


Code
system "nohup mp $filein &";


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives