Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] "interactive" perl



Quoth Brett Robson (Tue 2000-08-29 05:30:45PM +0900):
> 
> I've been using perl for only about a year now, doing all the typical
> things.

<snip>
 
> I've got a rude shock [...]

You've been using Perl for a year and this is your first rude shock?
As one of my favourite professors says about Perl:

"Maybe I'm corrupted by normal language syntax."[1]

Now, about how I typically do interactive stuff in Perl:

print "Enter some value: ";
chomp( $answer = <STDIN> );

The chomp() bites off the newline at the end of the input. Of course,
you might want it, so if you do, do not chomp(), just say:

$answer = <STDIN>;

And of course, since it is Perl, it allows extreme laziness:

$answer = <>;

Hope I answered your question.


--Josh

[1] http://www.cs.wm.edu/~jmglov/quotations.html#kearns


-- 
Josh Glover <jmglov@example.com>

Associate Systems Administrator
INCOGEN, Inc.
http://www.incogen.com/

GPG keyID 0x62386967 (7479 1A7A 46E6 041D 67AE  2546 A867 DBB1 6238 6967)
gpg --keyserver pgp.mit.edu --recv-keys 62386967

Attachment: pgp00079.pgp
Description: PGP signature


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links