#!/usr/bin/perl use strict; use warnings; my $file = "./file.txt"; # File data looks like: (without the beginning hash) # tag: variable open(FILE, $file); if ( grep /^tag\: (.*)$/, ) { print "Found tag: $1\n"; } # end-if close(FILE); exit;