Perl $1 giving uninitialized value error -



Perl $1 giving uninitialized value error -

i trying extract part of string , set new variable. string looking @ is:

maker-scaffold_26653|ref0016423-snap-gene-0.1

(inside $gene_name variable)

and thing want match is:

scaffold_26653|ref0016423

i'm using next piece of code:

my $gene_name; $scaffold_name; if ($gene_name =~ m/scaffold_[0-9]+\|ref[0-9]+/) { $scaffold_name = $1; print "$scaffold_name\n"; }

i'm getting next error when trying execute:

use of uninitialized value $scaffold_name in concatenation (.) or string

i know pattern right, because if utilize $' instead of $1

-snap-gene-0.1

i'm @ bit of loss: why $1 not work here?

if want utilize value matching have create () arround character in regex

perl

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -