currently i have a Variable named $name which contains "JOHN,SMITH".
What i'm looking to do is take the first letter of the first and last name and assign it to another variable without changing $name.
what i tried was this:
Code:
$OF = $name =~ s/^(.).*,(.).*/$1$2/;
so what i'm getting is a value of 1 for $OF and name is changing to JS.
how do i get $OF to be JS and $name to stay "JOHN,SMITH"
thanks
Edit: figured it out:
Code:
($OF = $name) =~ s/^(.).*,(.).*/$1$2/;