[EMAIL PROTECTED] writes ..
>(name = john)
-
>if I am trying to just extract "john" for the value $b, why would the
>following script not work. I thought it would take bothIt returns the
>full (name=john)
>
>#!user/local/bin/perl -w
>
>open TRY , "try.txt";
>
>while (<TRY>) {
> (my $b=$_) =~ s/^(\() (\w+)/$2/;
> print $b;
>}
in the name of TMTOWTDI
while(<TRY>)
{
chop( my $name = substr $_, rindex( $_, ' ')+1);
print $name, "\n";
}
but I suspect (from the statement about the output being '(name=john)') that
those spaces might not always be there .. in which case
while(<TRY>)
{
/=\s*(.*)\)/ && print $1, "\n";
}
--
jason king
In Denmark, if a horse carriage is trying to pass a car and the horse
gets uneasy, the car is required to pull over and stop. If necessary
to ease the horse down, you are required to cover the car up. -
http://dumblaws.com/