catfish1116 has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a very simple script but dont understand why chomp($_ = <STDIN>) works and chomp(my $selection = <STDIN>) doesnt. Below is code written with chomp set to default.
print "Enter a string that will match the secret matching pattern \n" +; chomp ($_ = <STDIN>); if ($_ = (/(.)\1/)) { print "The match was perfect \n"; } else { print
TIA The Catfish
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Why does default $_ only work
by haukex (Archbishop) on Aug 10, 2020 at 18:31 UTC | |
Re: Why does default $_ only work
by LanX (Saint) on Aug 10, 2020 at 18:07 UTC | |
Re: Why does default $_ only work
by catfish1116 (Beadle) on Aug 10, 2020 at 18:51 UTC | |
by BillKSmith (Monsignor) on Aug 10, 2020 at 19:41 UTC | |
by LanX (Saint) on Aug 10, 2020 at 19:39 UTC | |
by perlfan (Parson) on Aug 10, 2020 at 19:38 UTC | |
by haukex (Archbishop) on Aug 10, 2020 at 19:43 UTC | |
by perlfan (Parson) on Aug 10, 2020 at 19:48 UTC |