Thanks everyone for the help!
I get an error on 'chop' when I use the following. Why is this so?
Thanks
use strict;
use warnings;
my @eightdecks = 1..20;
my $last = chop ($eightdecks[0] + $eightdecks[2]);
if ($last =~ /[0-5]/){
print "yes match.\n";
}else{print "not match\n"};
----- Original Message -----
From: "John W. Krahn" <[EMAIL PROTECTED]>
To: "Perl Beginners" <beginners@perl.org>
Sent: Wednesday, April 02, 2008 12:06 AM
Subject: Re: how to extract the last digit
[EMAIL PROTECTED] wrote:
Hi,
Hello,
How do I extract the last digit of a number? example I only want the
digit 9 from the number 19.
my $number = 19;
my $last_digit = chop $number;
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/