[ale] Off topic - perl question

Keith R. Watson keith.watson at gtri.gatech.edu
Wed Aug 25 15:28:58 EDT 1999


Jim,

$test = "abc.xyz";

@fi = split (/\./,$test);
print "$#fi";
print " splitting $test, first part = $fi[0], second part = $fi[1]\n";


output looks like the following:

1 splitting abc.xyz, first part = abc, second part = xyz


keith

At 03:14 PM 8/25/99 -0400, you wrote:
>What is wrong with this?  I can't make it do what I want it to.
>
>$test = "abc.xyz";
>
>@fi = split (".",$test);
>print "$#fi";
>print " splitting $test, first part = $fi[0], second part = $fi[1]\n";
>
># $#fi = -1, according to the output
>
>$test = "abc,xyz";
>
>@fi = split (",",$test);
>print "$#fi";
>print " splitting $test, first part = $fi[0], second part = $fi[1]\n";
>
># this works fine so it is the period that is causing the problem but
>I've tried:
>@fi = split ("\.",$test);
>
>@fi = split ('.',$test);
>
>@fi = split (/./,$test);
>
>@fi = split (/"."/,$test);
>
>@fi = split (/"\."/,$test);
>
>to no avail.
>

-------------

Keith R. Watson                        GTRI/AIST
Computer Services Specialist IV        Georgia Institute of Technology
keith.watson at gtri.gatech.edu           Atlanta, GA  30332-0816
404-894-0836






More information about the Ale mailing list