Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: In my perl script one of the variable it is giving an extra dot.

by choroba (Archbishop)
on May 25, 2022 at 08:18 UTC ( #11144179=note: print w/replies, xml ) Need Help??


in reply to In my perl script one of the variable it is giving an extra dot.

A dot has a special meaning in regexes, it matches any character except newline. To match a literal dot, you need to backslash it.

Moreover, you probably don't want to remove a dot from somewhere further inside the string, only the starting one. You can add ^ to the regex, it only matches at the beginning of the string.

The final g means "global", it will remove all the occurrences of the pattern. As we only want to remove a single occurrence, we don't need it.

$file =~ s{^\.}{};

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2022-08-08 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?