catfish1116 has asked for the wisdom of the Perl Monks concerning the following question:
I'm not getting any errors but program doesn't pick up the first character if it is a '@'. code below
#* Progrmm prompts user fpr input and determines # ## which data type it is (scalar array or hash) # ## # ##################################################### print "Enter a string and I will determine the data type: "; chomp(my $_ = <STDIN>); if ($_ = (m/^[\$]\w/)) { print "\nThat is a scalar data type\n"; } elsif ($_ = (m/^[\@]\w/)) { print "\nThat is an array data type\n"; } else { print "\nData type not found\n"; }
it will recognize the '$' leading character but not the '@'. In my code I have the match set up the same. TIA The Catfish
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: If statement not working
by choroba (Cardinal) on Jun 25, 2020 at 17:21 UTC | |
Re: If statement not working
by perlfan (Vicar) on Jun 25, 2020 at 17:39 UTC | |
by AnomalousMonk (Archbishop) on Jun 25, 2020 at 18:44 UTC | |
by perlfan (Vicar) on Jun 25, 2020 at 19:59 UTC |
Back to
Seekers of Perl Wisdom