Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to remove the ' marks from the data stored in a variable

Status
Not open for further replies.

jewel464g

Technical User
Jul 18, 2001
198
US
I have a variable $username it contains data such as 'jewel'
I need it to contain just jewel so anyone got a quick fix for me?

When faced with a decision, always ask, 'Which would be the most fun?'
 
If you only want to remove leading and trailing single quotes, then
Code:
my $username = "'O'Reilly'";
$username =~ s/^'|'$//g;
print "$username\n";
will do the trick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top