The point is, that PDL
is a perl extension that is designed for scientific and bulk numeric data processing and display. So its really not made for String manipulating. When you try to iterate through a piddle:
use strict;
use warnings;
use PDL;
my $a = pdl ['suze','david'];
print $_ . "\n" foreach ($a->list);
You will get:
Argument "suze" isn't numeric in subroutine entry at Basic/Core/Core.pm.PL (i.e. PDL::Core.pm) line 1296, <DATA> line 207.
0
0
Argument "david" isn't numeric in subroutine entry at Basic/Core/Core.pm.PL (i.e. PDL::Core.pm) line 1296, <DATA> line 207.
When you take a deeper look into the POD, you will find:
$a = pdl(SCALAR|ARRAY REFERENCE|ARRAY|STRING);
For the constructor and the followed text for STRING
The string version of pdl also allows you to use the strings bad, inf, and nan, and it will insert the values that you mean (and set the bad flag if you use bad). You can mix and match case, though you shouldn't.
Back to your main problem, why do you use PDL
for strings? - Why not using a simple Array?
use strict;
use warnings;
use Data::Dumper;
my $a = ['suze','david'];
s/suze/female/ for @{$a};
print Dumper $a;
Output:
$VAR1 = [
'female',
'david'
];