Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Selecting Ranges of 2-Dimensional Data (updated)

by haukex (Archbishop)
on Oct 26, 2018 at 18:20 UTC ( [id://1224746]=note: print w/replies, xml ) Need Help??


in reply to Selecting Ranges of 2-Dimensional Data

Reinventing the wheel wasn't too terrible... I'm still interested whether it was necessary! ;-)

Replies are listed 'Best First'.
Re^2: Selecting Ranges of 2-Dimensional Data
by Aldebaran (Curate) on Oct 26, 2018 at 22:30 UTC

    I think that part of testing code is trying to understand it and then giving it more cases. In order for me to see what is happening here, I had to add a routine to print the array as we are accustomed to seeing 2d arrays. I had to add a bunch of say statements to suss out the internals. I got my first look at is_deeply, where the 3rd argument $test_name must be optional:

    is_deeply is_deeply( $got, $expected, $test_name );

    I'm also new with the syntax involving alias, so I printed out values to form a question there. I added a test to substitute in an 'M', intentionally causing the ultimate test to fail, to see if it would. I'll list output and then source between readmore tags:

    Q1) What is the purpose of using alias in this line

    alias my $r = $$range[$i];

    when it goes out of scope at the end of the loop?

    I always enjoy reading your posts, haukex, finding them challenging in the right way. I hope you don't resent me "embellishing" on your script.

      What is the purpose of using alias in this line alias my $r = $$range[$i];

      It was just to shorten code, and play around with Data::Alias a bit. Since LanX showed that the module isn't necessary (because the elements of @_ are already aliases), I removed it and posted an updated getsubset here.

      I hope you don't resent me "embellishing" on your script.

      Not at all, do whatever you need to figure stuff out, that's why I post publicly :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1224746]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-24 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found