Dave, I did it this way
$variable = substr($orig_variable,0,length($orig_variable)-2); I actually only removed the last 2 characters but I don't see why you could not put a 4 and remove last four.. I am sort of new at perl but I did get the above to work. I needed to drop off 2 number off of a directory for a scritp I was writing.. and I used it like this: $new_variable = substr($directory,0,length($directory)-2); I hope this helps. chad On Tue, 23 Jul 2002 14:00:37 +0200 "David Samuelsson (PAC)" <[EMAIL PROTECTED]> wrote: > This should be really simple, just use a regexp to remove the 4 last > letters from a variable. > > $variable =~ /\S\S\S\S$/; > print "$variable"; > > but this doesnt remove the 4 last letters when i run it, i think i am > just getting tired here and cant see why, what is the right way to do > it? :) > > //Dave > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]