Perl STDIN

Any other programming language that is not covered in the Web Scripting category.

Perl STDIN

Postby ravenhair on Fri Jun 09, 2006 7:01 pm

Ok so i'm trying to use perl to do some scripts, I haven't found a good way to handle user input the $var=<STDIN> works well except for the lack of backspace. I've aslo noticed that if i go in and out of functions STDIN seems to get disconected.

Any suggestions on other way's to handle user input?

ex:

Code: Select all

printf "account name:";
my $name=<STDIN>;
chomp ($name);
ravenhair
Regular
Regular
 
Posts: 80
Joined: Tue Nov 08, 2005 5:51 pm

Postby borg on Sun Jul 02, 2006 10:57 pm

<STDIN> is the default way of grabbing user input. if you find that it gets lost in between functions, try to save them into a variable first, then pass that variable to the next function you want to use.
borg
Newbie
Newbie
 
Posts: 15
Joined: Sun Jul 02, 2006 10:32 pm

Postby bart416 on Tue Jul 04, 2006 8:12 pm

You are better of using a readline library.
It offers a lot more features and the chance you'll miss input is smaller.
bart416
Valued Member
Valued Member
 
Posts: 164
Joined: Fri Sep 30, 2005 6:50 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron