in reply to Why do I get this error?

LanX is right about $" being a standard variable and global. He is also right that its default value must have been changed somewhere (possibly in a module you use) to undef to raise the warning you are seeing.

You can "fix" the value of $" by:

local $" = ' '; open ...

which restores the default space used for $".

If you recently added use warnings to your script that would show a warning for a nasty condition that you previously weren't aware of. An array interpolated into as string behaves like:

my $arrayStr = join $", @{$table_A[$d]}; my $row1 = "$arrayStr";

so the undef value in $" would have turned into an empty string and the array elements would have been stuck together instead of separated by single spaces.

Perl is the programming world's equivalent of English

Replies are listed 'Best First'.
Re^2: Why do I get this error?
by LanX (Saint) on May 12, 2014 at 02:19 UTC
    > You can "fix" the value of $" by:

    > local $" = ' ';

    Well I didn't suggest this, cause any row element containing spaces will contain tabs after the s/\s/\t/g.

    Using an explicit join is much cleaner.

    Otherwise better local $" = "\t"; and no substitution at all...

    Cheers Rolf

    ( addicted to the Perl Programming Language)