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

Re: Delete "/" in a string

by Loops (Curate)
on Oct 23, 2014 at 03:22 UTC ( [id://1104730]=note: print w/replies, xml ) Need Help??


in reply to Delete "/" in a string

Hi WTem, welcome to the monastery. As with all things Perl, there is more than one way to do this. As long as you have at least Perl 5.14 (which added the /r regex modifier), this will work too and wont touch the original $interface value:

my ($ip,$interface) = ('192.168.1.1', 'POS1/0/0'); my $filename = sprintf '%s--%s.txt', $ip, $interface =~ s#/##gr; print $filename, "\n";
will print:
192.168.1.1--POS100.txt

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-19 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found