#!/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);'
In reply to Re: redirecting stdin on windows
by defyance
in thread redirecting stdin on windows
by arkamedis21
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |