On Tue, 23 Jul 2002, David Samuelsson (PAC) wrote:

> This should be really simple, just use a regexp to remove the 4 last letters from a 
>variable.
> 
> $variable =~ /\S\S\S\S$/;

This just checks if your patter \S... matches with the
contents of $variable.
This should be $variable =~ s/\S\S\S\S$// or $variable =~ s/\S{4}$//;

This can also be done using substr (perldoc -f substr)
$variable = substr ($variable, 0, -4); 
or
substr ($variable, -4, length($variable), '');

> 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]

Reply via email to