Yes that is correct, assuming I understood what you wanted?
The regex will pick out the second field from every line of the file and store it in $second_field.
If you want all second fields to be put in an array or something you'd need:
/^\d+\|([^|]+)/ and push @array, $1;
The regex will pick out the second field from every line of the file and store it in $second_field.
If you want all second fields to be put in an array or something you'd need:
/^\d+\|([^|]+)/ and push @array, $1;