#!/usr/bin/perl use strict; use warnings; my @fields = qw/foo bar baz/; print join ('|', @fields[0,1]) . "\n";