in reply to redirecting stdin on windows
#!/path/to/perl -w use strict; my $uname; my $passwd; print "username:"; chomp($uname = <STDIN>); #catch stdin, get rid of trailing newline print "Your Username is: $uname"; #print it out print "password:"; chomp($passwd = <STDIN>);
Alternativly, if your wanting to pass these vars to another program, you could do this:
#!/path/to/perl -w use strict; my $uname; my $passwd; print "username:"; chomp($uname = <STDIN>); print "password:"; chomp($passwd = <STDIN>); system("/path/to/prog", "$uname", "$passwd");
It all depends on what you want to do with it, if you wanna elaborate on what it is you want to do, we could help with it, there's just some basic ideas. Also, you say you are new to Perl, You should check out the Tutorials, also, a book called "Learning Perl", an O'reilly Book, devoted to learning the rich language we call Perl.
UPDATE:Fixed a syntax error, heh.
--~~--~~--~~--~~--~~--~~--~~--~~--~~--~~--~~--~~--~~--
perl -e '$a="3567"; $b=hex($a); printf("%2X\n",$a);'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: redirecting stdin on windows
by arkamedis21 (Acolyte) on Aug 20, 2002 at 18:47 UTC | |
by arkamedis21 (Acolyte) on Aug 20, 2002 at 18:51 UTC | |
by defyance (Curate) on Aug 20, 2002 at 19:21 UTC | |
by waswas-fng (Curate) on Aug 20, 2002 at 19:39 UTC | |
by defyance (Curate) on Aug 20, 2002 at 19:50 UTC | |
by arkamedis21 (Acolyte) on Aug 20, 2002 at 19:58 UTC | |
by defyance (Curate) on Aug 20, 2002 at 20:10 UTC |