my @parts = split '|', $id; # ouch! what trivial error! is: /\|/ see choroba below my $filename = $parts[0]; # or simply my $filename = (split '|', $id)[0]; # ouch! what trivial error! is: /\|/ see choroba below