in reply to Check if a variable contains only one letter?
You should say "it contains X from the beginning to the end":
$myvar =~ /^X+$/;
Update: Be careful as "XXXX\n" also matches, so you might need to chomp first.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Check if a variable contains only one letter?
by tobyink (Canon) on May 02, 2014 at 22:59 UTC | |
Re^2: Check if a variable contains only one letter?
by DrHyde (Prior) on May 06, 2014 at 10:38 UTC |
In Section
Seekers of Perl Wisdom