in reply to Using regex with a variable
please first of all reformat your question (edit) addig code tags around your code. See Markup in the Monastery
Second, to store a regex into a variable you need the qr operator; you'll find in the Quote and quote like operator part of perlop
ps as always someone burned me on the time.. so i add a little example.. ;=)
perl -e "$regex = qr/=/; print ref $regex,' ',$regex" Regexp (?^:=)
and see also: /o is dead, long live qr//!
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using regex with a variable
by Praveen Dharmaraj (Novice) on Mar 14, 2016 at 08:50 UTC | |
by Discipulus (Canon) on Mar 14, 2016 at 09:19 UTC | |
by Praveen Dharmaraj (Novice) on Mar 14, 2016 at 09:27 UTC | |
by Discipulus (Canon) on Mar 14, 2016 at 09:43 UTC | |
by Praveen Dharmaraj (Novice) on Mar 15, 2016 at 05:18 UTC | |
| |
by Praveen Dharmaraj (Novice) on Mar 14, 2016 at 09:31 UTC | |
by GrandFather (Saint) on Mar 14, 2016 at 11:00 UTC |