#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my ($file) = glob '*.fastq'; open $fh, $file; my $analysis = []; # each element a sequence position # at which we will put a hash of freqs print localtime() . "\n"; while ( my $hdr = <$fh>) { my $seq = <$fh>; chomp $seq; analyse($seq, $analysis); $seq = <$fh> for (0 .. 1); # discard trailer } print localtime() . "\n"; print Dumper($analysis); sub analyse { my ($seq, $analysis) = @_; my $pos = length($seq); while ($pos) { $analysis->[--$pos]{chop $seq}++; } }