I would prbally add a seperator less common than a comma
such as || to use the split funciton on...
james
hi,
$name_with_id looks like a comma separated list
you can simply *not tested*:
($name,$id) = split (/,/, $name_with_id)
--
franck
Sara wrote:
> An input string like;
>
> $name_with_id = "Deiley, Sara Jr., 1234";
>
> another example could be
>
> $name_with_id = "DEILEY SARA, Jr,. 123";
>
> Two things are for sure in it always.
>
> 1- First part contains the alphabets (caps or small) with any number of
commas and periods (full stops) in between or at the end.
>
> and then always a white space, followed by:
>
> 2- the last part contains the digit/number which could be 2 - 5 digits
long.
>
> What I am trying to do is to split this string in two parts
> first part with alphatbets and second part with digits separately
>
> and assign them to two new variables i.e $name and $id.
>
> I am trying this;
>
> $name_with_id = "Deiley, Sara Jr., 1234";
>
> split (/[^\d]+/, $name_with_id) = ($name,$id);
>
> print "name: $name and ID: $id";
>
> Error: Can't modify split in scalar assignment at line 3;
>
> Any help or alternative way to do this.
>
> Thanks,
>
> Sara.
>
>
>
>
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]