#!/usr/bin/perl while (<>){ $nf = @fields = split (/\//); print (@fields[$nf-1]); }