The_Shadow has asked for the wisdom of the Perl Monks concerning the following question:
The whole point of this is the make $input 11 characters long so it can be compared with another variable read from a file. What I would like to know is is there a better way to do this?use strict; use warnings; my $input; my $length; print "Enter ID Number: "; $input = <STDIN>; chomp($input); do { $input = "0" . $input; $length = length($input); } until $length eq "11";
edited: Tue Aug 13 15:05:35 2002 by jeffa - added code tags, removed unnecessary br tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is There A Better Way?
by Shendal (Hermit) on Aug 13, 2002 at 15:12 UTC | |
|
Re: Is There A Better Way?
by simeon2000 (Monk) on Aug 13, 2002 at 15:12 UTC | |
by simeon2000 (Monk) on Aug 13, 2002 at 15:47 UTC | |
by rob_au (Abbot) on Aug 14, 2002 at 02:01 UTC | |
|
Re: Is There A Better Way?
by tjh (Curate) on Aug 13, 2002 at 18:44 UTC | |
|
Re: Is There A Better Way?
by The_Shadow (Novice) on Aug 13, 2002 at 20:07 UTC |