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
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
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$//
$var =~ s/.{4}$//;
Rgds,
Connie
- Original Message -
From: David Samuelsson (PAC) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 23, 2002 8:00 PM
Subject: Remove 4 last letters
This should be really simple, just use a regexp to remove the 4 last letters from a
variable
David Samuelsson 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
$variable =~ s/\S\S\S\S$//;
Heehee.. just for fun, what about if
$variable = 123456\t8\t0 ? =)
Rgds,
Connie
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe,