Perl: the Markov chain saw | |
PerlMonks |
Organizing Links - Better to use hash, hash of arrays, or...?by CalebH (Acolyte) |
on Feb 02, 2014 at 00:54 UTC ( [id://1073008]=perlquestion: print w/replies, xml ) | Need Help?? |
CalebH has asked for the wisdom of the Perl Monks concerning the following question:
Greetings, Monks! Currently, I realize that I have way to many links cluttering my computer. When I find an interesting link, I mail it to myself, which now has my email folder filled with 2000+ links. In order to combat that, I wrote a script (discussed in Perl MIME parser partially works) to pull those links from my email and add them to a logfile. The problem is that I also have shortcuts from my Firefox bookmarks, Internet Explorer shortcuts from right clicking and bookmarking pages, etc. What I am trying to do, and need help with, is organizing these links into a logfile. From the email parser I am currently using, I have modified the logging to log 3 things : The link, the title of the page (taken from $Subject), and the date that it was sent (taken from $date). I basically want to do the following: - log the urls to a text file (for this example, URLs.txt), in a format similar to Url|Title|Date(s)|Count (If seen multiple times, it would be Url|Title|10/31/05 5:54PM, 01/05/10 10:10AM| Count: 2) - be able to parse more urls (Bookmarks exported from Firefox, or shortcuts, or future emails), and increment any values seen in the previous logfile (URLS.txt), so that if the link was previously seen it would increment it and add any relative information. My first thought is to use a hash, like But how would I do this with all of the values I want to save? The above looks like it would store the url, and nothing else in its current form. I figure a push would take care of the dates, but I'm not sure how to implement it. How would I do something so I ended up with something like... Apologies for the long rambling post, and I hope I explained everthing well enough. I couldn't exactly figure out how to describe what I needed, so hopefully this got it down!
Back to
Seekers of Perl Wisdom
|
|