Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: hey monks

by rjt (Curate)
on Apr 24, 2014 at 19:10 UTC ( [id://1083673]=note: print w/replies, xml ) Need Help??


in reply to creating a LINK

It's not exactly clear what you're asking. First, please see How do I post a question effectively? and, "hey monks": How do I compose an effective node title?

In general terms, however, there are numerous ways to do what you ask. Consider this example:

my @arr = ( { filename => 'foo.txt', time => time(), filetype => 'furry', }, { filename => 'readme', time => time(), filetype => 'blue' }, );

Now @arr contains references to two hashes, each containing the fields you specified (in lowercase, you can use uppercase if you really want to, but most Perl code wouldn't).

To pull together all files of a specific filetype, you can use this sort of construct:

my @blue_files = grep { $_->{filetype} eq 'blue' } @arr;

And to print the filenames from that:

print "$_->{filename}\n" for @blue_files;

Hopefully these very simple examples will be relevant to you, and will help you grasp some of the basics. Please do make good use of perlintro and the other resources here.

use strict; use warnings; omitted for brevity.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-25 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found