Krambambuli has asked for the wisdom of the Perl Monks concerning the following question:
It's working ok, but I wonder if there aren't better/nicer ways to do it.#!/usr/bin/perl use strict; use warnings; my $text = 'abcd@efgh@ijk@lmn@opq@rst'; my $str_index = length($text) -1 - index( reverse( $text ), '@', 0 ); print "str_index: $str_index\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Index of the last occurence of a character inside a string
by dHarry (Abbot) on Aug 06, 2008 at 09:47 UTC | |
by Krambambuli (Curate) on Aug 06, 2008 at 10:00 UTC | |
|
Re: Index of the last occurence of a character inside a string
by FunkyMonk (Bishop) on Aug 06, 2008 at 09:47 UTC | |
|
Re: Index of the last occurence of a character inside a string
by ambrus (Abbot) on Aug 06, 2008 at 11:55 UTC |