ok I think all of that is simply:### grabbing every column my $dbCommand = qq^select ^; foreach (@ticketsFields) { $dbCommand .= "$_,"; } $dbCommand =~ s/,$//;
Why do you need this copy? and deref doesn't need {} , just use @$rows ..my $dbCommand = 'select '.join ',',@ticketsFields;
All of this:my @newArray = @{$rows};
might be something like:for(my $x = 0; $x < $ticketsFieldsSize; $x++) { ### assign the key and value in the hash $GenericData{$ticketsFields[$x]} = $newArray[$x]; }
and lastly, you don't need a "return" at the end- whatever value is at the end, IS returned:@GenericData{@ticketsFields} = @$rows;
\@ticketsRecords; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is there a cleaner way to write this code below, which includes derferencing references, that themselves have to be dereferenced?
by bartender1382 (Beadle) on May 05, 2022 at 19:57 UTC | |
by GrandFather (Saint) on May 05, 2022 at 21:58 UTC |