in reply to Re^4: An overlapping regex capture
in thread An overlapping regex capture

If so create a new variable for the filename, just before creating the file, as in
foreach $id (keys %id2seq){ # here the last good possibility to cut $id: my $filename = (split /\|/, $id)[0]; ...

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.