Karyn Williams wrote: > This is probably very simple, but I'm not seeing it. I want to do the > following: > > > my $lfirst = $first; > $lfirst =~ s/[^a-zA-Z]//g; > > in one line. I tried : > > my $lfirst = ($first =~ s/[^a-zA-Z]//g); > > but it returned either a blank or null. > > I want to maintain the state of $first and store the alpha only version in > $lfirst.
You need to put parentheses around the assignment so that it happens first. ( my $lfirst = $first ) =~ tr/a-zA-Z//cd; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/