my $first = (split /=/, $string)[0]; # or even... my ($first) = split /=/, $string;