From: "Chas. Owens" <[EMAIL PROTECTED]>
> 2008/4/3 Jay Savage <[EMAIL PROTECTED]>:
> snip
> > Exactly. The functionality is there to be taken advantage of. I don't
> > see why that is "unfortunate" at all. How is "Mongolian digit three"
> > less of a digit than arabic numeral three? That \d is u
2008/4/3 Jay Savage <[EMAIL PROTECTED]>:
snip
> Exactly. The functionality is there to be taken advantage of. I don't
> see why that is "unfortunate" at all. How is "Mongolian digit three"
> less of a digit than arabic numeral three? That \d is unicode-aware
> is, IMO, it's strongest selling po
On Tue, Apr 1, 2008 at 5:40 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> 2008/4/1 Jay Savage <[EMAIL PROTECTED]>:
> snip
>
> > my ($last) = $number =~ /.*(\d)/;
> >
> > Let Perl worry about what is and isn't a digit.
> snip
>
> Unfortunately, with the rise of UNICODE, \d is no longer what
[EMAIL PROTECTED] wrote:
>
> 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
From: "sanket vaidya" <[EMAIL PROTECTED]>
> You get the error on chop because anything given with chop function is
> considered as string (In other words chop acts on string). So perl considers
> the '+' operator you provide with chop as string rather than addition
> operator.This is how your task
From: <[EMAIL PROTECTED]>
> 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]);
Because chop() attempts to modif
Subject: Re: how to extract the last digit
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 &q
e{print "not match\n"};
- Original Message -
From: "John W. Krahn" <[EMAIL PROTECTED]>
To: "Perl Beginners"
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 digi
On Tue, Apr 1, 2008 at 5:17 PM, yitzle <[EMAIL PROTECTED]> wrote:
> On Tue, Apr 1, 2008 at 4:03 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> > yitzle wrote:
> > > Is there some way to convert it (a string/scalar) to an array?
> >
> > Is this what you mean?
> >
> > my $string = 'ABCDEF';
> >
2008/4/1 Jay Savage <[EMAIL PROTECTED]>:
snip
> my ($last) = $number =~ /.*(\d)/;
>
> Let Perl worry about what is and isn't a digit.
snip
Unfortunately, with the rise of UNICODE, \d is no longer what one
expects* ([0-9]). It now includes all characters marked as digits in
UNICODE. This inc
On Tue, Apr 1, 2008 at 4:03 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> yitzle wrote:
> > Is there some way to convert it (a string/scalar) to an array?
>
> Is this what you mean?
>
> my $string = 'ABCDEF';
> my @string = split '', $string;
>
>
>
> Rob
I suppose. That can be used to extract th
yitzle wrote:
> Is there some way to convert it (a string/scalar) to an array?
Is this what you mean?
my $string = 'ABCDEF';
my @string = split '', $string;
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Is there some way to convert it (a string/scalar) to an array?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On Tue, Apr 1, 2008 at 11:09 AM, Rob Dixon <[EMAIL PROTECTED]> wrote:
[snip]
>
> my ($lastdigit) = $number =~ /.*([0-9])/;
>
> gives you the last decimal digit (even if there are non-decimals after
> it).
>
Better yet:
my ($last) = $number =~ /.*(\d)/;
Let Perl worry about what is and
John W. Krahn wrote:
> [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;
Yes, although it's important to note that that method removes the
[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
[EMAIL PROTECTED] wrote:
>
> How do I extract the last digit of a number? example I only want the
digit 9 from the number 19.
>
> my $number = 19;
There are a few ways.
my $lastdigit = substr $number, -1;
gives you the last character in the string
my $lastdigit = $number % 10;
gives you t
Hi,
How do I extract the last digit of a number? example I only want the digit 9
from the number 19.
my $number = 19;
18 matches
Mail list logo