#!/usr/bin/perl use List::Util 'max'; use warnings; use strict; my $filename = shift || die("Please provide a input STL file"); my $command = shift || die ("Pleas provide read/write"); open(FH, "$filename"); my $old_address = 0; my %histogram; my $command_occurance = 0; while() { # Get the adress: $_ =~ /\d+:\s+(\w+)\s+0x([\w\d]+)\s*[\d\w]*/; if($command eq $1) { my $address = hex($2); my $distance = $address - $old_address; $histogram{$distance} ++; $old_address = $address; $command_occurance++; } } foreach my $key ( keys %histogram) { my $percent = $histogram{$key}/$command_occurance; my $hexkey = sprintf( "%032b", abs($key) ); print "0x".$hexkey." ".abs($key)." = ".$histogram{$key}." (".$percent.")\n"; }