#!/usr/bin/perl use strict; use warnings; my $line = 'Bond, James|007|Secret agent|Walther PPK|etc|etc|etc'; my $occupation = ( split /\|/, $line )[2]; print "$occupation man\n"; exit;