#!/usr/bin/perl -w use strict; open(FILE, '<', 'yourFile.txt') or die $!; my $lineno = 1; while (<FILE>) { print $lineno++; print ": $_"; } close FH;