Robert's Perl Tutorial

http://www.sthomas.net/roberts-perl-tutorial.htm


x

I hope you trusted me and typed the above in exactly as it is show (or pasted it), because the x is not a mistake, it is a feature. If you were too smart and changed it to a * or something change it back and see what it does.

Of course, there is another way to do it :

unless ($input=~/\d/) {
        print 'Your answer is ',$input x 3,"\n";
} else {
        print "Not a number !!!!\n";
}

which reverses the logic with an unless statement.