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

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: Found a Perl hole
by davido (Cardinal) on Jan 27, 2005 at 16:46 UTC

     = is the assignment operator.  == is a comparative operator. Are you getting the two confused? You shouldn't write if ( $this = $that ) { ... } if you're trying to compare $this to $that. If you're trying to assign $that to $this, and at the same time evaluate whether $this equates to truth, that's what you're accomplishing using the = operator inside an 'if' conditional.

    perlop


    Dave

Re: Found a Perl hole
by davis (Vicar) on Jan 27, 2005 at 16:47 UTC
    Eh?
    I'm going to make an assumption (dangerous, I know), and assume you're talking about this behaviour:
    #!/usr/bin/perl use warnings; use strict; use diagnostics; my $foo = 1; if($foo = 2) { print "Boo!\n"; }
    ... which produces the output:
    Found = in conditional, should be == at hole.pl line 8. (#1) (W syntax) You said if ($foo = 123) when you meant if ($foo == 123) (or something like that). Boo!
    ... which kind of explains it really.

    davis
    It wasn't easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.
Re: Found a Perl hole
by Anonymous Monk on Jan 27, 2005 at 17:13 UTC

    I was once infected with an integer hole. It ate up all the numbers with eights and nines in them. Everytime I used these numbers, I'd get error messages about invalid numbers. It was quite a pain.

    ...oh wait, I think I was working in octal.

Re: Found a Perl hole
by dragonchild (Archbishop) on Jan 27, 2005 at 16:46 UTC
    What on earth are you babbling about? Some code would be handy to see. And, the chances are 2134873298 to 1 that it's a documented behavior, but that you haven't read the document.

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

Re: Found a Perl hole
by tall_man (Parson) on Jan 27, 2005 at 16:47 UTC
    Perhaps if you supplied us with the code we could give you a better answer.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.