Min Wang wrote:

> Gunnar Hjalmarsson wrote:

>> Min Wang wrote:

>>> I have line in a file

>>> 001-02-0003

>>>

>>> I do

>>> ($a,$b,$c) = split('-',$_) after read.

>>> Now I print them I get 1,2,3 instead of 001,02,0003.

>>

>> $_ = '001-02-0003';

>> my ($x,$y,$z) = split /-/;

>> print "$x,$y,$z\n";

>>

>> Outputs:

>> 001,02,0003

>

> Thank you very much.

>

> Furthermore,

>

> I tried

>

> $x = substr($b, 0, 1);

> $y = substr($b, 1);

>

> I expect to have $x=0 and $y=2.

> In stead, I got $x = 2 and $y is null.
my $first = substr $y, 0, 1;

my $second = substr $y, 1;

print "First: $first, second: $second\n";

Outputs:

First: 0, second: 2

Funny computer you have.

How about following Anno's advice and post the exact code that

produces the results you say it does?

--

Gunnar Hjalmarsson

Email:

http://www.gunnar.cc/cgi-bin/contact.pl