Greetings Monks

This was inspired by a recent technique for frequency analysis
using hash references.I was curious if the same could be
accomplished by using only lists. The following code is the
result of creative kludge and insight into three dimensional
data structures.
#! /usr/bin/perl -w our @frequency; our @words; print "Which file requires frequency analysis please?\n"; $phile=<STDIN>; open(PHILE, "+< $phile") ||die "File specified can not be accessed:$!\n"; while (@interval=<PHILE>){ foreach $line(@interval){ chop $line; @werdz=split(/ / ,$line); $space=@werdz; analyize($space,@werdz); } } $initialize="abcdefghijklmnopqrsstuvwxyz"; unshift @words,$initialize; @alpha=alphatrans(); for $word(@words){ $lengh=@word; @letters=split (//, $word); foreach $key(@letters){ $key=uc $key; frequency($key); } } for $row(@frequency){ $lengh= @$row; $unit=$lengh-1; $token=shift @alpha; print " $token= $unit //// "; } sub analyize{ push @words, @werdz; } sub frequency{ $key=pop @_; for$i(0...25){ if( $alpha[$i] eq $key ){ push @{$frequency[$i]},$key; } } } sub alphatrans{ our @nums; our @pass1; foreach $k(0...25){ $i=$k; push (@nums, $k); $k=~ tr/0-9 /A-J/ ; push (@pass1, $k); } foreach $bdiad(@pass1){ if ($bdiad=~/B(.+)/){ push (@b,$bdiad); } } foreach $cdiad(@pass1){ if ($cdiad=~/C(.+)/){ push (@c,$cdiad); } } foreach $y (0..9){ $f=shift @b; $f=$y ; $y=~ tr/0-9/KLMNOPQRST/ ; push (@blist, $y ); } foreach $x (0..5){ $g=shift @c; $g=$x ; $x=~ tr/0-5/UVWXYZ/ ; push (@clist,$x ); } splice (@pass1, 10, 10,@blist); splice (@pass1, 20, 6, @clist); return @pass1; }

In reply to Frequency Analysis with Lists by dReKurCe

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.