The following code takes untrusted input and uses a regular expression to filter "../" from the input. It then appends this result to the /home/user/ directory and attempts to read the file in the final resulting path.
(bad code)
my $Username = GetUntrustedInput();
$Username =~ s/\.\.\///;