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: Intermediate:
Why does a perl script behave differently if I run it from code vs running it from the command line?

 



fulfowi
New User

Feb 3, 2017, 1:21 PM

Post #1 of 2 (2914 views)
Why does a perl script behave differently if I run it from code vs running it from the command line? Can't Post

Here's the input to my perl script:

setenv CLIENTS "a b c d"

Here's a snippet of my perl script:

use 5.0;
use strict;

my $clients = $ENV{CLIENTS};
print "$clients";

If I run from the command-line with a gnome-terminal or xterm the result is a d c d.

If I run from the code using system or QProcess with a gnomne-terminal or xterm the result is a.

Any ideas?


BillKSmith
Veteran

Feb 5, 2017, 8:56 PM

Post #2 of 2 (2883 views)
Re: [fulfowi] Why does a perl script behave differently if I run it from code vs running it from the command line? [In reply to] Can't Post

The man page for qprocess https://linux.die.net/man/3/qprocess explains what your must do to set environment variables. It is not the same as your shell.
Good Luck,
Bill

 
 


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

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