Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / July 2006



Tip: Looking for answers? Try searching our database.

Mac Perl bug?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ende - 18 Jul 2006 23:29 GMT
Why?

$a = "1  2 3";
    1  2 3
split / /, $a;
    [1, "", 2, 3]
split " ", $a;
    [1, 2, 3]

--
    Juan Falgueras
    Profesor del Depto. de Lenguajes y Ciencias de la Computación
    Universidad de Málaga
Paul McCann - 18 Jul 2006 23:37 GMT
Ende asked...

> Why?
>
[quoted text clipped - 4 lines]
> split " ", $a;
>     [1, 2, 3]

Using a single space as the string on which to split triggers a  
special case: from "perldoc -f split"

               specifying a PATTERN of space (' ') will
               split on white space just as "split" with no  
arguments does.

Cheers,
Paul
David Cantrell - 19 Jul 2006 12:56 GMT
On Wed, Jul 19, 2006 at 12:29:04AM +0200, ende wrote:

> Why?
>
[quoted text clipped - 4 lines]
> split " ", $a;
>     [1, 2, 3]

Splitting on / / is different from splitting on " " because " " is
magickal.  While this is mentioned in the docs for split(), it could
perhaps be written somewhat better.

Signature

David Cantrell | Enforcer, South London Linguistic Massive

Are you feeling bored? depressed? slowed down?  Evil Scientists may
be manipulating the speed of light in your vicinity.  Buy our patented
instructional video to find out how, and maybe YOU can stop THEM

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.