develooper Front page | perl.perl6.users | Postings from May 2012

Is rindex broken or does my brain need a reboot?

Thread Next
From:
Frederik Schwarzer
Date:
May 7, 2012 20:19
Subject:
Is rindex broken or does my brain need a reboot?
Message ID:
201205080519.41053.schwarzerf@gmail.com
Hi,

I had a little problem with rindex and wrote a small demo code that 
shows what I found.

The code is:
use v6;

my $string = "perl";
say $string;                                                                                                                                                                          
say $string.WHAT;                                                                                                                                                                     
say $string.index("e");                                                                                                                                                               
say $string.rindex("e");                                                                                                                                                              
                                                                                                                                                                                      
say "";                                                                                                                                                                               
say @*ARGS[0];                                                                                                                                                                        
say @*ARGS[0].WHAT;                                                                                                                                                                   
say @*ARGS[0].index("e");                                                                                                                                                             
say @*ARGS[0].rindex("e");                                                                                                                                                            

When run, I see the following (with a two-week old build of Rakudo 
master):
$ perl6 index.pl perl
perl
Str()
1
1

perl
Str()
1
Failure.new(exception => X::AdHoc.new(payload => "substring not 
found"))

Do I miss something? Any help is appreciated.

Regards

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About