in reply to Comparing Strings
Update: To reduce it even more:#!/usr/bin/perl -l use autodie; use strict qw/refs/; use warnings FATAL => 'all'; print "Enter a word: "; my $str1 = <STDIN>; my $str2 = 'Mahesh'; chomp $str1; print "Match" if $str1 eq $str2; print "No match" unless $str1 eq $str2;
#!/usr/bin/perl -l use strict; use warnings; print "Enter a word: "; my $str1 = <STDIN>; my $str2 = 'Mahesh'; chomp $str1; print $str1 eq $str2 ? 'Match' : 'No match';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparing Strings
by AnomalousMonk (Archbishop) on Jun 24, 2012 at 20:24 UTC |