length.sub subpos { # find the offset of any substring my ( $checkstring, $substring ) = @_; my $length = length( $substring ); my $limit = length( $checkstring ) - $length; for ( my $i = 0; $i < $limit; $i++ ) { ( substr( $checkstring, $i, $length ) eq $substring ) and return $i; } undef(); # or alternatively return -1 for not found }
^M Free your mind!
In reply to Re: matching a defined lenght
by Moron
in thread matching a defined lenght
by harryC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |