how to remove first word

Hi,

i have a question about to remove first word from a sentence.

my script;

#!/usr/bin/perl

$msgtxt = "this is a test script";

my @ap_txtMsg = split(/ +/, trim_data($msgtxt));

$ap_msgtxt = splice (@ap_txtMsg, 0, 1);

print $ap_msgtxt;

but the output is first word that i want to remove "this".

how i to make the ouput "is a test script" ?

TQ.

splice manipulates the array, and returns what was removed from it. After the splice, @ap_txtMsg will contain everything except the first word. So that's apparently what you will want to print.

To only remove the first word, and leave the spaces etc intact, perhaps what you want is really

$msgtxt =~ s/^\S+\s+//