#!/usr/bin/perl use strict; use warnings; if ("h@" =~ /(\@)/ ) { print $1 } if ("h@t" =~ /(\@)/ ) { print $1 }