Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

substitute string

Can anyone give me ahand with the following....

I would like to put ^ before every character and # after every character in a string of any length.

I have tried
$name = 123;
$name =~s/\B/#/g;
return $name;

and get 1#2#3

but have no idea how to get ^1#^2#^3#

Regards,
geoff
0
wapware
Asked:
wapware
1 Solution
 
ozoCommented:
$name =~s/(.)/^$1#/gs;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now