#!/usr/bin/env perl -l use strict; use warnings; my @resultarray; my $outputb; $resultarray[3] = 0; $outputb = "\t$resultarray[3]"; print '$resultarray[3] = |', $resultarray[3], '|'; print '$outputb = |', $outputb, '|'; check_for_match_zero('$resultarray[3]', $resultarray[3]); check_for_match_zero('$outputb', $outputb); sub check_for_match_zero { my ($name, $value) = @_; if ($value =~ /^0$/) { print "$name (with value: '$value') MATCHES zero."; } else { print "$name (with value: '$value') DOES NOT MATCH zero."; } }