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

if ($?variable_name) what does this syntax translate to .I am not quite sure and request the esteemed monks to throw some light on it .. Thanks

Replies are listed 'Best First'.
Re: if ($?variable_name)
by LanX (Saint) on Jul 24, 2013 at 20:55 UTC
    nothing, it's a syntax error

    Bareword found where operator expected

    you're sure you didn't confuse the programming language?

    Cheers Rolf

    ( addicted to the Perl Programming Language)

    PS: FWIW $? exists!

Re: if ($?variable_name)
by Laurent_R (Canon) on Jul 24, 2013 at 22:16 UTC

    Or possibly you don't really ask the right question. Because something like "$?" does indeed look quite perlish. But "if ($?variable_name)" does not make much sense to me.

    $? is a special variable that contains the return code or error status of that last child spawned or forked by your program, for example by a `...` backticks command or by a system command. Maybe you should explain better your question.

      The script which i am looking at has both the perl and tcsh interpreter definded. I am wondering it may be a tcsh syntax then as it does not fit the context . I think it means if the variable variable_name exists get in the if condition ,looking at the context . But not sure .. Thanks
        Seems you have the answer. The tcsh documentation says:
           $?name
           ${?name}
                       Substitutes the string `1' if name is set, `0' if it is not.
        
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ