in reply to Read from Input

Hi, I am very new to perl, just started this week :) so my question might sound a bit dumb but I am lost and need some help. I am trying to write a simple program which will read a number input by the user and print it. 10x

You can get input from the user by reading from "STDIN", the standard input device, which defaults to your keyboard.

my $input = <STDIN>;
You can print that input, which is now in the variable $input, with the print statement.
print $input;
Did you want it printed 10 times, or was that 10 kisses? ;-)
print $input x 10;
When you get input from the keyboard, you also get the newline character at the end. If you don't want that, use the 'chomp' function to get rid of it. I suggest you check out the excellent Tutorials on this site, and don't forget to use Super Search to look up more examples that you can learn from.

Replies are listed 'Best First'.
Re: Re: Read from Input
by ysth (Canon) on May 07, 2004 at 15:50 UTC
    10x => ten X => thanks