in reply to regex needed
"If I'm trying to do an exact match..."Exact match for what?
Anyway, does this do what you want?
Cheers,#!/usr/bin/perl -l use strict; use warnings; my $var = 'Sensor30'; while (<DATA>) { chomp; print if m/^\Q$var\E$/; } __DATA__ >Sensor30 >FooSensor30 > Sensor30 Sensor300 Sensor30 >Sensor3
|
|---|