allori has asked for the wisdom of the Perl Monks concerning the following question:
Example code:
#!/usr/bin/perl -w use strict; use PDL; use PDL::IO::FITS; my $test = "This is a test and I hope it works."; my $pos4 = index($test,"test"); print "pos4 = $pos4\n"; exit(0);
This gives me the error:
Argument "This is a test and I hope it works." isn't numeric in subroutine entry at index_test.pl line 6.
Argument "test" isn't numeric in subroutine entry at index_test.pl line 6.
pos4 = 0There is no error if I comment out the "use PDL;" statements; and $pos4 contains the correct character position for the substring "test". My perl script needs to work with FITS files, so I need the PDL module.
Does anyone have a suggestion on how I can get this to work?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl index function error when "use PDL"
by pvaldes (Chaplain) on Oct 27, 2011 at 23:32 UTC | |
by syphilis (Archbishop) on Oct 28, 2011 at 01:34 UTC | |
by BrowserUk (Patriarch) on Oct 28, 2011 at 01:41 UTC | |
by syphilis (Archbishop) on Oct 28, 2011 at 03:05 UTC | |
by BrowserUk (Patriarch) on Oct 28, 2011 at 03:28 UTC | |
|
Re: perl index function error when "use PDL"
by Lotus1 (Vicar) on Oct 28, 2011 at 01:56 UTC | |
|
Re: perl index function error when "use PDL"
by Khen1950fx (Canon) on Oct 28, 2011 at 01:55 UTC | |
|
Re: perl index function error when "use PDL"
by zentara (Cardinal) on Oct 28, 2011 at 15:16 UTC | |
|
Re: perl index function error when "use PDL"
by allori (Initiate) on Oct 28, 2011 at 15:19 UTC |