[Melbourne-pm] Pls explain?
Ben Hare
benhare at gmail.com
Tue Oct 23 18:17:04 PDT 2007
> my $job_name = "backfill_" if $backfill;
> $job_name .= "migrate_$n";
> print "Job name: $job_name\n";
Mat/Brendon,
this is just Perl punishing you for writing the above code. please
stop confusing Perl.
thank you.
Ben.
PS: hope you guys are well!!! :D
On 10/24/07, Brendon Oliver <brendon.oliver at gmail.com> wrote:
> On Wednesday 24 October 2007 10:34:50 you wrote:
> > >
> > > my $job_name = "backfill_" if $backfill;
> >
> > This line above is like writing:
> >
> > my $a if $b;
> >
> > So the lexical variable $a only springs into existence if $b is true.
> > Therefore (since $backfill isn't true)
> >
> > > $job_name .= "migrate_$n";
> >
> > this must be the global $job_name; hence the behaviour you see.
>
> Yes, but with 'use strict', where is this "global" $job_name declared? (there
> is none at the main:: scope) That's the bit that was puzzling me...
>
> > There is a
> > (lame) excuse for why you don't get strict errors and warnings, but I don't
> > remember what it is, and personally I think it's a bug.
>
> :-)
>
> > You can fix get_name_1 by doing:
>
> Yep, already did a similar work-around.
>
> Anyways, no big drama - just sort of an itch I couldn't scratch because I
> hadn't come across this before.
>
> Thanks for the reply tho.
>
> regards,
>
> - Brendon.
>
> --
> Optimism is the content of small men in high places.
> -- F. Scott Fitzgerald, "The Crack Up"
>
> 10:46:07 up 8 days, 22:11, 3 users, load average: 0.04, 0.17, 0.18
>
> _______________________________________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://mail.pm.org/mailman/listinfo/melbourne-pm
>
More information about the Melbourne-pm
mailing list