in reply to printing the subscript separator

If you want to avoid printing undef's and pure whitespace:
print $op if defined($op) and $op =~ /\S/;
If any spaces at all are verboten, you want
print $op if defined($op) and $op !~ /\s/;
It would help if you clearly stated what you did and did not want to print.

Replies are listed 'Best First'.
Re^2: printing the subscript separator
by nobull (Friar) on Feb 09, 2005 at 20:03 UTC
    You should not fear no warnings 'uninitialized'.

    It's not generally a good idea to set it globally but when you really want undef to behave like an empty string for a few lines it's not a bad approach.

    { no warnings 'uninitialized'; print $op if $op =~ /\S/; }

    To be honest it's probably not appropriate for a single line like this but it's a good tool to have in your box.

    Another useful tool is for(SCALAR).

    for ($op) { print if defined && /\S/; }
Re^2: printing the subscript separator
by jacques (Priest) on Feb 09, 2005 at 18:35 UTC
    It would help if you clearly stated what you did and did not want to print.

    I updated my OP.

      Feggedaboudit.