1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

passing paramter from one script to another script in perl

Discussion in 'Perl' started by john83reuben, Feb 28, 2008.

  1. john83reuben

    john83reuben New Member

    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.
     
  2. john83reuben

    john83reuben New Member

    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";
     
  3. john83reuben

    john83reuben New Member

    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
     

Share This Page