I wrote some code to take this file:
File: 02packages.details.txt URL: http://www.perl.com/CPAN/modules/02packages.details.txt Description: Package names found in directory $CPAN/authors/id/ Columns: package name, version, path Intended-For: Automated fetch routines, namespace documentation. Written-By: mldistwatch (v 2.343) by Andreas.Koenig@anima.de Line-Count: 14257 Last-Updated: Mon, 28 Oct 2002 14:53:05 GMT A::B undef M/MA/MARCEL/Devel-SearchINC-0 +.01.tar.gz Aardvark undef D/DU/DUNCAND/CGI-Portable-0.4 +7.tar.gz abbreviation 0.02 M/MI/MIYAGAWA/abbreviation-0. +02.tar.gz ABI 0.01 M/MA/MALAY/ABI-0.01.tar.gz about undef S/SH/SHERWOOD/xisofs-1.3.tar. +gz Ace 1.83 L/LD/LDS/AcePerl-1.83.tar.gz Ace::Browser::AceSubs 1.21 L/LD/LDS/AcePerl-1.83.tar.gz Ace::Browser::GeneSubs undef L/LD/LDS/AcePerl-1.83.tar.gz Ace::Browser::SearchSubs undef L/LD/LDS/AcePerl-1.83.tar.gz Ace::Browser::SiteDefs undef L/LD/LDS/AcePerl-1.82.tar.gz Ace::Browser::TreeSubs undef L/LD/LDS/AcePerl-1.83.tar.gz Ace::Freesubs 1.00 L/LD/LDS/AcePerl-1.83.tar.gz Ace::Graphics::Fk undef L/LD/LDS/AcePerl-1.82.tar.gz Ace::Graphics::Glyph undef L/LD/LDS/AcePerl-1.82.tar.gz Ace::Graphics::Glyph::anchored_arrow undef L/LD/LDS/AcePerl-1.82.tar. +gz Ace::Graphics::Glyph::arrow undef L/LD/LDS/AcePerl-1.82.tar.gz Ace::Graphics::Glyph::box undef L/LD/LDS/AcePerl-1.83.tar.gz
and turn it into a hohohohohohoh:
my $data_line = qr/(\S+)\s+\S+\s+\S+\d+.tar.gz/; use vars qw(%pkg); sub build { my $file = shift; use FileHandle; my $fh = new FileHandle $file or die "couldnt open: $!"; while (<$fh>) { next unless /$data_line/; my $pkg = $1; my @tree_struct = split '::', $pkg; @tree_struct = map { "'$_'" } @tree_struct; my $join = join '}{', @tree_struct ; $join = "{$join}"; my $eval = "\$pkg$join = '$pkg'"; warn $eval; eval $eval; } use Data::Dumper; warn Dumper(\%pkg); }

But I am leery of using eval and think that there must be some more structural as opposed to string-based method of creating my hohohohohohohoh


In reply to How to dynamically (yet structurally) creat a hohohohoh by princepawn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.