#! /usr/bin/perl -w use strict; die "Not enough arguments" if $#ARGV < 2; my ($start, $end, $file) = @ARGV; open FILE, $file or die "Couldn't open file"; while () { my @chars = split //; print @chars[$start..$end], "\n" if @chars >= $end; }