Lightning flashed, thunder crashed and Walnut <[EMAIL PROTECTED]> whispered:
| Why not split it into an array first:
|
| @fields =~ split(!/!, $string);
|
| $index = $fields(3);
| $value = $fields(5);
This does not do what I think you think it does. ;-)
This will try to call a function that is pointed to by the reference
$fields with an argument of either 3 or 5. Did you perhaps mean
$fields[3]? I still don't think this solves the problem, though.
| >Hi all,
| >I have sucked two substrings into two variables :
| >
| >$index = substr $_, 35, 11;
| >$value = substr $_, 64, 6;
| >
| >These variables may or may not have leading zero/s :
| >
| >000009/000099/000999........ and so on.
| >
| >If they do I need to strip away the leading zeros.
I think you need to give us a bit more information. Is "000009/..." $_?
If so, how did you come up with the offsets? Are you guaranteed that
$index and $value will only have digits in them? If so, $index+0 will
conver the string "000234" into the digit 234. Or, if you want, you can
use /^0+/ to remove the leading zeros.
-spp
--
Stephen P Potter [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point." -Simon Cozens
UNIX, Perl, PHP, Web Consulting and Training http://www.unixlabs.net/~spp/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]