in reply to Re^2: Transferring hash keys to array... Need help sorting
in thread Transferring hash keys to array... Need help sorting

In that case, you might find the concept of structured data useful.

my $data = { key1 => { label => "label1", content => [...] }, key2 => ..., };
The above's a HoH, i.e. hash of hashes. Start reading with perldsc perhaps.

Replies are listed 'Best First'.
Re^4: Transferring hash keys to array... Need help sorting
by DARK SCIENTIST (Novice) on Apr 21, 2017 at 18:28 UTC
    I actually have a hash set up already that contains keys= the labels and values= sequence content. I read these keys and values into an array because it was easier to manipulate them (reverse and tr them and insert spaces between characters). Is there a way to just manipulate them straight from a hash reference instead of putting the keys and values into arrays? If so, I can just avoid arrays all together

      Of course you can manipulate the data. For example:

      foreach my $record (values %$HoH) { $record->{label} =~ tr/A-Za-z/N-ZA-Mn-za-m/; }
      Should perform the rot13 cryption on all the label fields. See perlop for =~, tr, etc.

        I'm a little new to Perl (clearly) and this makes things much easier... My use of arrays was pointless. I'm just going to copy and paste all the code manipulating the arrays and operate on the hash. Thanks