Hi, You can do it like: $var =~ s/\[|\]//g; or $var =~ s/[\[\]]//g; -----Original Message----- From: [EMAIL PROTECTED] To: beginners@perl.org Sent: Fri, 15 Sep 2006 1:54 PM Subject: removing characters
Hi, I have a certain variables of emplyee number which comes in the format of [a0000000] or [u0000000] {whereby 0000000 is some serial numbers}. I would like to remove the enclosed [ & ] see if it is belong to class a or u , i can do it as follow $var = /\[//; $var = /\]//; if ($var =~ '^a) { print "$var is class A"; } elsfi ($var =~ '^u) { print '$var is class U"; } $var = /a//; $var = /u//; How can i remove the chars all in a single line? and write the code in a more perl manner ? regards rexo ________________________________________________________________________ Check out the new AOL. Most comprehensive set of free safety and security tools, free access to millions of high-quality videos from across the web, free AOL Mail and more.