Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Perl (http://www.go4expert.com/forums/perl/)
-   -   passing paramter from one script to another script in perl (http://www.go4expert.com/forums/passing-paramter-script-script-perl-t9078/)

john83reuben 28Feb2008 09:57

passing paramter from one script to another script in perl
 
Hi guys. I have a question, just wondering bout it. JUst say I have a script called firstscript.pl

#!/usr/bin/perl

print "enter name\n";
$name = <STDIN>;

How to pass $name paramter to another script.

For example, my second script is called secondscript.pl

#!/usr/bin/perl

print "the name entered is $name\n";

Pls help guys..
Thank you.

john83reuben 28Feb2008 10:34

Re: passing paramter from one script to another script in perl
 
Guys, I have solved the above problem.

firstscript.pl


#!/usr/bin/perl

use CGI;

print "enter name\n";
$name = <STDIN>;

#system("./pass2.pl $name" == 0);
#use pass2.pl (name);

our($username) = ($name);do "pass2.pl";


secondscript.pl

#!/usr/bin/perl

print "the name enter was $username\n";

john83reuben 28Feb2008 11:57

Re: passing paramter from one script to another script in perl
 
Now I have a problem, I user the same technique, but this time is not happening. Can u guys look through my code, and see whats the problem

firstscript.cgi

#!/usr/bin/perl

use strict;
use CGI;

my $q = new CGI;
my $name = $q->param( "name" );
my $password = $q->param( "password" );
my $pass = crypt($paswd,"password");
our($username,$paswd) = ($name,$pass);do "secondscript.cgi";
system("sudo su assistant");

secondscript.cgi

#!/usr/bin/perl

system("sudo /usr/sbin/useradd -m -p $paswd $username");


Since this is regarding creating username and etc, I have done some apache configuration and etc/sudoers configuration.

pls help


All times are GMT +5.5. The time now is 06:28.