however it is a working hack job which is perfect for what i needed to do to help a friend out. And he is currently very impressed with the community.
anyways heres the scenario.
modify the subpages of this link so that similarly paged links are shifted over by headings.
Here is the final code.
#!/usr/bin/perl -w use strict; sub go{ my $temp; my %DB; my $hist; my $tab= "  "; my $head; my $c=0; my ($r) = shift @_; open (F,$r) || die "Couldnt open $! $r"; $r =~ s/\./1\./; #@Data = <F>; my $store = "<Head>"; while (<F>){ if (/.*<B>/ && ! /Last modified/){ #If line is a title $temp = $_; $_=~ s/(<[^<>]+>)+//g; chomp; if (/\(/){ $store = $_; $store =~ s/[\(\)]//g; $DB{$store} = $temp; }else{ $store = $_; $store =~ s/[\(\)]//g; $DB{$store} = $temp; } }else{ #Not a title ($store ne "<Head>")? $DB{$store}:$head .= $_; } } print "writing $r"; open (N, ">$r")||die "Can't open to write"; print N "$head";$hist = "---"; foreach (sort keys %DB){ if ((/^$hist[s:]* /)){ $DB{$_} =~ s/<\/*B>/$tab/; $DB{$_} =~ s/<DD>/<DD>$tab/; print N "$DB{$_}"; }else{ $hist = $_; print N $DB{$_}; } } } my @t; my @DIR; my $d; opendir (D,".") || die "Could not open directory! Check to make sure t +his file is in the right place. $!"; @DIR = readdir (D); print "Please select a file to modify\n"; $d=0; foreach (@DIR){ if (/keyword.\.html/){push @t, $_;print ++$d.". $_\n";} ; } print "Selection: "; $a = <>; go $t[$a-1] || die "Invalid Number! Try something within below $#t GOS +H!!!";
I used grandfathers advice, i havent tried many others. i realized a regex error late in the game because some hash values had '(' that were messing up the code... Feel free to throw modifications to this, my buddy just may use it! Thanks a lot
In reply to Re: Reading from large files
by zer
in thread Reading from large files
by zer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |