Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^4: Split Decision

by Aragorn (Curate)
on Jan 06, 2005 at 14:58 UTC ( #419943=note: print w/replies, xml ) Need Help??

in reply to Re^3: Split Decision
in thread Split Decision

Some playing around shows it's not an exception:
#!/usr/bin/perl my $string = "Bla\nBlo\nBloe"; print join("|", split('something', $string));
This code is parsed as
~$ perl -MO=Deparse my $string = "Bla\nBlo\nBloe"; print join('|', split(/something/, $string, 0)); syntax OK
The same goes for double quotes. split() expects a regex, but apparently will settle for things in quotes and interpret the string as a regex. Indeed, you live and learn :-)


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://419943]
[Corion]: marto: No, a Sun Balcony, it was an ill-fated attempt to revive the Sparc series after the Pizzabox :)
[marto]: ah Sun, I sold my Pizzabox in around 2005
[Corion]: I used one at $work as a terminal, but those days are long gone by ;)
[marto]: I have an old IBM infowindow terminal to repurpose, I'll just wire a raspberry piz zero to the cable, providing access and wiFi :P
[marto]: the kids will love it
[Corion]: marto: Hehe ;) I've been toying with the idea of soldering an USB (-C) hub into a keyboard and making it a computer by slotting my phone into that :)

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2018-03-21 11:22 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (267 votes). Check out past polls.