http://qs321.pair.com?node_id=1200630


in reply to Odd behavior of file test

Hi Trudge,

You'll need to post more of your code (like where you assign to $Cover) for us to be sure, but it certainly looks like $Cover is not getting assigned the way you expect.

If you're reticent to post code, you can always print out the expected value of $Cover, at various lines, with:

printf "Now at line %d: \$Cover = '%s'\n", __LINE__, $Cover;

and see where it's not assigned to the expected value.

Does that help?

say  substr+lc crypt(qw $i3 SI$),4,5

Replies are listed 'Best First'.
Re^2: Odd behavior of file test
by Trudge (Acolyte) on Oct 04, 2017 at 00:41 UTC

    OK, I've tried your suggestion in several places and it all comes back correctly with 'cover.jpg'. There was a section containing a function call, and I was able to print correctly before, during, and after the function.

    Also tried it in my file-test block and no joy! There is definitely something wonky going on.

Re^2: Odd behavior of file test
by Trudge (Acolyte) on Oct 04, 2017 at 00:25 UTC

    Hi golux, and thank you for a quick response. Here is where I assign $Cover ...

    my $Cover="cover.jpg";

    which is quite a bit ahead of this section of the script. And I checked again to make sure the file exists - which it does.

    I will take your suggestion and try printing $Cover in various places and post results here.