Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Is there a cleaner way to write this code below, which includes derferencing references, that themselves have to be dereferenced?

by BillKSmith (Monsignor)
on May 06, 2022 at 14:10 UTC ( [id://11143629]=note: print w/replies, xml ) Need Help??


in reply to Is there a cleaner way to write this code below, which includes derferencing references, that themselves have to be dereferenced?

The use of the function map rather than foreach... and zip (from List::MoreUtils) eliminates the need for all your temporary variables and the associated reference/dereference.
use List::MoreUtils qw(zip); my $TicketRecords = [] ; @{$TicketRecords} = map { { zip @TicketFields, @$_ } } @$data;
Bill
  • Comment on Re: Is there a cleaner way to write this code below, which includes derferencing references, that themselves have to be dereferenced?
  • Select or Download Code

Log In?
Username:
Password:

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

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

    No recent polls found