in reply to take out section of a string then put it back

Sorry to say, I'm having a hard time understanding what it is you are doing, but if you want to store that first word:

#!/usr/bin/perl -w use strict; my $temp = "Firstword and then the rest of the string"; $temp =~ /^(\w+)/i; my $firstword = $1;
BTW, it's more efficient to use groups--the stuff in parens--in your reg exp instead of $`,$&,$'. So:

my $temp = "Firstword and then the rest of the string"; $temp =~ /^(\w+)([ \w]*)/i; my $firstword = $1; my $restofstring = $2;


Anyone else?