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

After battling with Image Magik libraries for a while I finally found a solution to my problem of passing parameters to GetPixels.
my $readval=$imagetarget->Get('pixel['.$xcount.','.$ycount.']');
Thanks to the monk who posted this elsewhere. Now, what sort of an ugly construct is this? I have never come across this way of shoehorning parameters into a function/method before. Can someone explain what is going on and why it is necessary to do this? Cheers. Andy.

Replies are listed 'Best First'.
Re: Odd way of passing parameters
by Belgarion (Chaplain) on May 04, 2004 at 20:13 UTC

    I can't comment on why the call is required to be pixel[x,y], but I have to ask why you couldn't just use:

    my $readval=$imagetarget->Get("pixel[$xcount,$ycount]");

    I tried a test with that syntax and it appears to work correctly. Did I miss something that's unique to Image Magick?

      No you didn't , it was a general question about the form of the expression. Thanks Belgarion, now you rewrite it with interpolating double quotes I can see what's going on, the append(dots) were confusing me. Respects, Andy.