Thanks to everyone for all the help.

It is now working.
I am going to use the following code:
 ($a,$b,$c,$d,$e,$f) = split /[\-\/\.]/, $string;


On Wednesday 14 April 2004 14:30, Stacy Doss wrote:
> You need to be aware that split works on a regexp therefore the /./ is
> matching any character. I'm not sure what you vars $projectnumber and $pa
> are but I'll assum you want something like this....
>
> $string = '500/00-7.1.19.3';
> # This will split the whole string at once retaining only the digits for
> each lhs variable.
> ($a,$b,$c,$d,$e,$f) = split /\D+/, $string;
>
> # This will split the whole string at once on any of the three characters /
> - . for each lhs variable.($a,
> # You don't really need to escape the characters, I do just so I don't have
> to think about it.
> ($a,$b,$c,$d,$e,$f) = split /[\-\/\.]/, $string;
>
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> Jon Shorie
> Sent: Wednesday, April 14, 2004 1:13 PM
> To: [EMAIL PROTECTED]
> Subject: [Perl-unix-users] Problem that I am having with split command
>
>
> If I have the following kind of data
> 500/00-7.1.19.3
>
> I want to split it into separate variables as such
> $a = "500"
> $b = "00"
> $c = "7"
> $d = "1"
> $e = "19"
> $f = "3"
>
> Here is what I have so far
>
> ($a,$g) = split("/",$projectnumber);
> ($b,$g) = split(/-/,$pa);
> ($c,$d,$e,$f) = split(/./,$g);
> print "$a xx $b xx $c xx $d xx $e xx $f xx $g \n";
>
> the output is:
> 500 xx 00 xx  xx  xx  xx  xx 7.1.19.3
>
> It appears to not be splitting on the . Does anybody have any ideas?
>
> _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to