raghu_shekar has asked for the wisdom of the Perl Monks concerning the following question:

Hi, am back again..... how do i deal with the error "Possible unintended interpolation of @xyz"....

Replies are listed 'Best First'.
Re: Interpolation problem in perl
by almut (Canon) on Mar 19, 2009 at 10:32 UTC

    ...you put a backslash before the '@' character(s) in your string literal(s) :)

    Background is that when Perl sees something like "foo abc@xyz bar", it attempts to interpolate an array @xyz, and if there is no such array in the program, Perl warns that this interpolation might be unintended...

    BTW, with use diagnostics, you would have gotten virtually the same explanation for free:

    Possible unintended interpolation of @xyz in string at ... (W ambiguous) You said something like `@foo' in a double-quoted st +ring but there was no array @foo in scope at the time. If you wanted a literal @foo, then write it as \@foo; otherwise find out what happ +ened to the array you apparently lost track of.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Interpolation problem in perl
by ww (Archbishop) on Mar 19, 2009 at 10:40 UTC
    It's a lot easier for us to help when a question includes the code (and data) that produces that warning.

    You've received essentially this answer to each question you've posted. Please help us avoid the waste of storage and bandwidth by including code and data (if relevant) each time you post a new question.

Re: Interpolation problem in perl
by Anonymous Monk on Mar 19, 2009 at 10:54 UTC
    splain, diagnostics, perldiag
    Possible unintended interpolation of %s in string

    (W ambiguous) You said something like `@foo' in a double-quoted string but there was no array @foo in scope at the time. If you wanted a literal @foo, then write it as \@foo; otherwise find out what happened to the array you apparently lost track of.

    perltrap: Interpolation Traps
    @ now always interpolates an array in double-quotish strings.
    print "To: someone@somewhere.com\n"; # perl4 prints: To:someone@somewhere.com # perl < 5.6.1, error : In string, @somewhere now must be written as \ +@somewhere # perl >= 5.6.1, warning : Possible unintended interpolation of @somew +here in string
    How to RTFM