dpath2o has asked for the wisdom of the Perl Monks concerning the following question:
Hi, This is somewhat basic so I apologise if this has been answered somewhere, but I had difficulty in finding the solution using some simple searches. Regardless, my problem is that I'm having a conflict in using 'PDL::index' and Perl's 'index'. Basically I have a script that is using predominantly PDL coding but I'd like to take advantage of Perl's index function, something like this:
use PDL; ... (a bunch of PDL lines of code) ...; $tmpsub = substr( $perlstr , index( $perlstr , /myregex/ ) , $position );The problem with the above line is that it attempts to use PDL::Index. I have tried to the following as a solution:
use PDL; ... (a bunch of PDL lines of code) ...; $tmpsub = substr( $perlstr , $main::index( $perlstr , /myregex/ ) , $position );But this fails because of my lack of understanding. Basically I would like to use Perl's main 'index' function in the above line and not PDL's 'index'. Hopefully this is a straightforward solution, and that I will not receive too much bludgeoning for having asked such a trivial question. Kind Regards, Dan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perlfunc index name conflict
by ikegami (Patriarch) on Sep 24, 2012 at 01:10 UTC | |
|
Re: perlfunc index name conflict
by chuckbutler (Monsignor) on Sep 23, 2012 at 22:50 UTC | |
by dpath2o (Acolyte) on Sep 24, 2012 at 00:11 UTC | |
by Anonymous Monk on Sep 24, 2012 at 00:09 UTC | |
by AnomalousMonk (Archbishop) on Sep 24, 2012 at 08:30 UTC | |
|
Re: perlfunc index name conflict
by Anonymous Monk on Sep 23, 2012 at 22:40 UTC | |
by syphilis (Archbishop) on Sep 23, 2012 at 23:09 UTC |