#!/usr/bin/perl -w use strict; #putting the line in question into $_ for this example. $_ = "Cell ID for Last Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'503E"; #create our hash of 'site codes' => 'text to print' my %cells = ('207B' => 'Miami', '432F' => 'Buffalo', '443R' => 'Whatever you want for cell site 443R', '503E' => 'Portland, OR' ); if (/CI: x'(\w+)$/) { print "Cell site is $cells{$1}.\n"; }