Eth443 has asked for the wisdom of the Perl Monks concerning the following question:
Hi...again! The idea => The array is like the last one
@bad_answer=( "Bad", "Bad to be honest", "Not good", "Not good enough" );
Now I would like to know if it's possible when the user put with <STDIN> something prove if it is in the array (i know how to do this) and if it isn't save it for ever as part of the initial array.Prob. my explication is quite short, if there's any dude, ask
my $useranswer=<STDIN>; if ($useranswer~~@bad_answer){print "ok";} #shotversion else{SAVE THE DATA INSIDE THE ARRAY} @bad_answer=( "Bad", "Bad to be honest", "Not good", "Not good enough", "USER INPUT"#I'll have 3 different arrays );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Write an user answer inside an array
by AnomalousMonk (Archbishop) on May 04, 2015 at 23:31 UTC | |
|
Re: Write an user answer inside an array
by jeffa (Bishop) on May 04, 2015 at 23:32 UTC | |
by Eth443 (Initiate) on May 04, 2015 at 23:35 UTC | |
by Anonymous Monk on May 05, 2015 at 00:07 UTC |