This is simple substitution command. Find lines starting with ">" up to "|" and replace the whole line with that part you want... \( \) determines whats held in \1
the first ^ anchors to beginning of line, the next ^ is part of a grouping, meaning not "|"
You could also try the slightly simpler awk and sed commands:
awk -F'|' '{print $1}' input
and
sed 's/|.*//' input
The awk command uses "|" as the field separator and prints the 1st field on every input line.
The sed command removes "|" and anything that follows it from every input line that contains a "|" and then prints the resulting lines (whether or not they changed).
#!/usr/bin/env perl
open( $fh, "<", "yourfile") or die "Cannot open file: $!\n";
# go through the file line by line
while( my $line = <$fh>) {
chomp($line); # get rid of newline
$line =~ s/\|.*$// if $line =~ /^>/; # remove everything after pipe if start with >
print $line."\n";
}