> -----Original Message-----
> From: Sabherwal, Balvinder (MBS)
> I wanted to know if it is ok to do something like $var =
> substring($var,10,20); in the perl script. I am trying to
> save the use of
> another variable in my script. If not, is there any other
> better method of
> doing this??
Did you try it? I just did and the following code seems OK:
----------8<----------CODE---------->8----------
use strict;
use warnings;
# Some test data
my $var = 'abcdefghijklmnopqrstuvwxyz1234567890';
# The the command from the question
$var = substr $var, 10, 20; # Assign variable to it's own string
# Print the results
print "$var\n";
# Below is a silly regex to do the same thing.
# It was my backup plan if the above didn't work.
# I do NOT recommend this approach. I was just
# curious if it would work. -Gerb
#
$var = 'abcdefghijklmnopqrstuvwxyz1234567890';
$var =~ s/.{10}(.{20}).*/$1/;
print "$var\n";
__END__
----------8<----------CODE---------->8----------
Chris
LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged.
It is intended for the addressee(s) only. Access to this E-mail by anyone else is
unauthorized. If you are not an addressee, any disclosure or copying of the contents
of this E-mail or any action taken (or not taken) in reliance on it is unauthorized
and may be unlawful. If you are not an addressee, please inform the sender immediately.
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs