shadow52 wrote:
> Hey everyone,
> 
> I am trying to get just the last 3 numbers from the following number
> from perl using regexs but I have not had no success so I was hoping
> that I could get a little help on this. I just ordered the regex book
> from oreilly so that hopefully in the future I will not have to ask a
> question like this again.
> 
> The number is 0000000000000111
> 
> I was just wanting to get the last 3 digits from this number to be
> able to get an exact word phrase from my already loaded Hash table
> that I have created for various numbers that I will get the last 3
> numbers from. Oh yeah all I was doing was putting this number in a
> file and then passing it to perl on the command line incase that is
> needed.
> 
> Any help is much appreciated or if you can just point me to a good
> place to get a better understanding of how to do this while I wait for
> my book to arrive.
> 
> Thanks,
> shadow52
> 
> 

my $n = "0000000000000111";
my ( $last_3_digits ) = $n =~ m{ (\d\d\d) \z }msx;
print "$last_3_digits\n";


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to