#!/usr/bin/perl use strict; use warnings; my $in = 'srd^1|name|mail@mail.com^dsff'; print join ' ', (split (/[\^\|]/, $in))[1..3];