in reply to Re: Global symbol
in thread Global symbol

Perhaps you shouldn't try and offer advice if you don't understand things . . .

At any rate, he's building up a string to pass to eval using a heredoc. Since he hasn't explicitly wrapped the terminator token in single quotes it will interpolate variables like a double quoted string. And since @array will interpolate in a double quoted string he's backwhacking the initial @ since he wants the literal text my @fields = ($val =~ /$ivalue/...); (... being the interpolated contents of $modifiers). What actually gets passed to eval doesn't have any extraneous backwhacks in it. The next obvious step in debugging this is would be to print out the code that's misbehaving when being passed to eval (or printing the code if $@ is set after the eval indicating problems).

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^3: Global symbol
by psini (Deacon) on Jun 19, 2008 at 14:54 UTC

    You are perfectly right :(

    I didn't notice the first line of the code snippet and read the remaining completely out of context. Sorry.

    Careful with that hash Eugene.

      Commiserations. Another Perl Best Practice shows its value.

      Since he hasn't explicitly wrapped the terminator token in single quotes it will interpolate variables like a double quoted string.

      Heredoc Quoters

      When introducing a heredoc, quote the terminator.

      Adding the explicit quotes around the heredoc marker takes almost no extra effort, but it relieves every reader of having to remember the default behavior.

Re^3: Global symbol
by shekhar (Initiate) on Jun 20, 2008 at 05:18 UTC
    Thanks a lot Fletch for your response. I will check out with the actual contents that are being passed to this code snippet.