use strict; use warnings; my @path = split(/\\/, "c:\\windows\\desktop\\pic3.jpg"); print pop(@path);