Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Input/Output through the Keyboard

by Zaxo (Archbishop)
on Nov 13, 2002 at 02:46 UTC ( [id://212479]=note: print w/replies, xml ) Need Help??


in reply to Input/Output through the Keyboard

The keyboard input is captured on STDIN:

#!/usr/bin/perl use warnings; use strict; my $input; print("Your number: "), chomp( $input = <STDIN> ) until $input =~ /^\d+$/; print 3 * $input - 1, $/;

The print, chomp sequence uses the comma operator to make the two part of a single expression for the modifier. The alternative is do { print... ; chomp ...;} until ...;.

After Compline,
Zaxo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://212479]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-03-28 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found