Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^5: An overlapping regex capture

by hexcoder (Curate)
on Jun 22, 2017 at 11:22 UTC ( [id://1193274]=note: print w/replies, xml ) Need Help??


in reply to Re^4: An overlapping regex capture
in thread An overlapping regex capture

No, you got the error saying that $filename.fa is uninitialized.

So perl saw that as a variable name while you intended to only use $filename instead.

In order to delimit the variable name you can use this syntax: "${filename}.fa".

Good luck, hexcoder

Replies are listed 'Best First'.
Re^6: An overlapping regex capture
by haukex (Archbishop) on Jun 22, 2017 at 12:40 UTC
    No, you got the error saying that $filename.fa is uninitialized. So perl saw that as a variable name ...

    Sorry, but that's not correct in this case, a dot does end the variable name being interpolated. As the OP is using strict, that would have caught the error anyway. Your advice does apply for other characters though.

    $ perl -wMstrict -le 'my $fn="x"; print "$fn.y"' x.y $ perl -wMstrict -le 'my $fn="x"; print "$fn_y"' Global symbol "$fn_y" requires explicit package name (did you forget t +o declare "my $fn_y"?) at -e line 1. Execution of -e aborted due to compilation errors. $ perl -w -le 'my $fn="x"; print "$fn_y"' Name "main::fn_y" used only once: possible typo at -e line 1. Use of uninitialized value $fn_y in string at -e line 1. $ perl -wMstrict -le 'my $fn="x"; print "${fn}_y"' x_y

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1193274]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-16 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found