#!/usr/bin/perl -w use strict; while( ) { $_ =~ s{^\./}{}; # This regular expression does the work. print $_; } __DATA__ ./file1.txt file1./file2.log ../file3.txt file4.cpp