perl coding ?

Mark Ovens mark at ukug.uk.freebsd.org
Wed Apr 21 10:32:31 PDT 2004


JJB wrote:

> I have an perl scrip somebody else wrote.
> I am just learning perl by modifying this script.
> An temp field $dup-counter contains an counter that is suffixed with
> x
> as in 23x  have no idea how big of an number the counter can grow
> to.
> The suffix is all ways one position but has different alpha values.
> 
> How do I separate $dup-counter into two new  fields?
> $dup-number  and  $dup-sufix
> 

This will do it:

$dup-number = substr($dup-counter, 0, length($dup-counter) - 1);
$dup-suffix = substr($dup-counter, -1, 1);

HTH

Regards,

Mark

> Thanks for you help
> 
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> 
> .
> 




More information about the freebsd-questions mailing list