#!/usr/bin/perl -w use strict; my $passwords = 'passwords'; my $rec_size = 9; my $password; open PASS, "+<$passwords" or die "Error message here $!"; # Seek from end of file seek PASS, -$rec_size, 2; # Store the position of the last seek my $last = tell PASS; # Read the password but not the newline read PASS, $password, $rec_size -1; # Remove the record just read truncate PASS, $last; close PASS; print $password, "\n"; __END__