From: Jorge on
Using ActiveState perl 5.8.8 on XP, I'm attempting to use an example
from the Perl Hacks book by O'reilly.

It uses Spreadsheet::Read and simply retrieves the row and cell data
from a .xls file.

However, it throws this error ...

Search pattern not terminated at ...

and then points to this line ...

print join "\t" => map {$sheet->{cell}[$_][$row] // "-"} 1 ..
$sheet->{maxcol};

The only search pattern I see on this line is the 2 slashes (//) and as
far as I know, they are valid delimiters for search patterns and are
applied correctly. Can anyone shed some light on what this error could
mean?

I can post the complete program if needed.

Thank You

Jorge

From: Paul on
The syntax is wrong. I'm not sure what // is supposed to be doing, but
whatever it is, it's wrong :)

From: Jorge on
Paul wrote:
> The syntax is wrong. I'm not sure what // is supposed to be doing, but
> whatever it is, it's wrong :)

You are correct. Since my posting, I have tracked down that the // is
the Perl 6 construct for defined-or, not a set of pattern delimiters as
I had presumed. Now, I have to re-write that portion of code so it
plays in Perl 5.8.8 or look for a patch to Perl 5.8.8.

Thank you

Jorge

From: anno4000 on
Jorge <awkster(a)yahoo.com> wrote in comp.lang.perl.misc:
> Paul wrote:
> > The syntax is wrong. I'm not sure what // is supposed to be doing, but
> > whatever it is, it's wrong :)
>
> You are correct. Since my posting, I have tracked down that the // is
> the Perl 6 construct for defined-or, not a set of pattern delimiters as
> I had presumed. Now, I have to re-write that portion of code so it
> plays in Perl 5.8.8 or look for a patch to Perl 5.8.8.

Replace (untested)

map {$sheet->{cell}[$_][$row] // "-"} 1 .. $sheet->{maxcol};

with

map defined ? $_ : '-', map $sheet->{cell}[$_][$row], 1 .. $sheet->{maxcol}

Btw, in the original code, the first slash is parsed as a division
operator. The second one seems to introduce an unterminated regex.

Anno
From: Paul on
> You are correct. Since my posting, I have tracked down that the // is
> the Perl 6 construct for defined-or, not a set of pattern delimiters as
> I had presumed.

No, defined-or is || so:

$foo ||= 'something';