Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

RE: RE: RE: Trying to make a search

by takshaka (Friar)
on Jun 05, 2000 at 00:57 UTC ( [id://16331]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: Trying to make a search
in thread Trying to make a search

also, why does everyone but me just assume in their solution that user will be well-behaved and only enter a single letter? i know we're not writing production code here, but it seems a little odd to me that i was the only one to bother to do 'substr $input, 0, 1'.

Perhaps it is a bleed-over of Perl's DWIM concept. It seems logical (to me, at least) that if the user inputs a string rather than a single character the program should return all lines beginning with that string. But then I imagine it is just as logical to you that the program should only use the first character as the search prefix.

In legitimate production code where we are concerned about how many characters the user inputs, it would probably be better to allow only one character--rather than an entire line--to be input in the first place (don't want to confuse those end-users). And since the OP does say 'letter', we'd also reject any input that isn't one.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found