in reply to Re: Interpolation Problem?
in thread Interpolation Problem?

If you mean #!/usr/bin/perl -w that's at the start of my test script. I only reproduced the piece of code where the error is being generated?

Replies are listed 'Best First'.
Re^3: Interpolation Problem?
by Corion (Patriarch) on May 07, 2009 at 12:29 UTC

    Oh - by using I implied that you need to read the output the warnings generate. And/or use strict; which will likely prevent the warning from ever being generated by turning it into a fatal error.

Re^3: Interpolation Problem?
by Ronnie (Scribe) on May 07, 2009 at 12:49 UTC
    I normally use "use strict" but had commented it out whilst trying to get something out of the script. When I put it back in I get
    Possible unintended interpolation of @rman in string at xxrc_env_test. +pl line 51. Global symbol "@rman" requires explicit package name at xxrc_env_test. +pl line 51. Execution of xxrc_env_test.pl aborted due to compilation errors.

    The error is much as I expected the problem is I don't know how to circumvent it.
      Then try use diagnostics.
      Possible unintended interpolation of @rman in string at xxrc_env_test. +pl line 51 (#1) (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. Global symbol "@rman" requires explicit package name at xxrc_env_test. +pl line 51 (#2) (F) You've said "use strict vars", which indicates that all variab +les must either be lexically scoped (using "my"), declared beforehand +using "our", or explicitly qualified to say which package the global var +iable is in (using "::"). Execution of xxrc_env_test.pl aborted due to compilation errors (#3) (F) The final summary message when a Perl compilation fails.
      perlintro covers interpolation.
        Sorry for wasting your time guys - I'd forgotten how to escape characters like @ in a string!! In my defense I have been off ill for 7 months and it's amazing how quickly you forget some of the basics!!
        Cheers

      The @ sign in your connect string is being interpreted as designating an rman array.

      You want a literal @ sign. Which requires … if you wanted to embed a " in a " delimited string you would …?

      Ah, this always aggravated me until my habits caught up with Perl. Use a \ before the @ to escape it

      connect catalog aaaaaaaaa/bbbbbbbb\@rman-live
      Update: When faced with a warning or error you're having troubles figuring out `man perldiag` is helpful. The explanations are concise and give examples.

      Be Appropriate && Follow Your Curiosity
      I noticed this admission in worst nodes, which seems unfair. Yes Ronnie did something stupid: he switched off strict so he could debug. Debugging is exactly what strict is for, so he shot himself in the foot.

      But downvoting the node where he admits his mistake seems counter-productive. It helps us to help others when they admit their mistakes. It would have been worse if Ronnie had simply said "It's ok, I fixed it now". As it stands, Ronnie has kindly reminded everyone - again - what strict is for!

      Some peoples purpose in life is to serve as a warning to others.


      - Boldra