in reply to Re: Remove $
in thread Remove $

I guess I am inside a double quoted string. I'm receiving the string from an Excel spreadsheet like this:

my $cellval = $Sheet->Cells($rownum,"B")->{'Value'};
chomp ($cellval);

As noted before it comes out like this:
db1$/SQL/GEMINI/StoredProcs/pboValidateClientRefNo_ClientID.sql

So how do I then convert that string to literal, remove the $, and flip back to interpreted? (that doesn't read right but I think you get the drift)

Replies are listed 'Best First'.
Re^3: Remove $
by FunkyMonk (Bishop) on Aug 27, 2007 at 16:12 UTC
    I think there's something else going on. What output do you get if you place a print either side of the substitute? ie

    my $cellval = $Sheet->Cells($rownum,"B")->{'Value'}; print "$cellval\n"; $cellval =~ s*\$**g; print "$cellval\n";

      it turns the $/ into a return

      Z:\Scripts>perl -w $.txt
      db1
      SQL/GEMINI/StoredProcs/pboValidateClientRefNo_ClientID.sql
      db1
      SQL/GEMINI/StoredProcs/pboValidateClientRefNo_ClientID.sql

      Z:\Scripts>
        It isn't the print that's doing the interpolation of $/, it's happening inside $Sheet->Cells($rownum,"B")->{'Value'};

        In which case I'd just hack it back to what it should be with (something like) $cellval = s!\n!/!g;