Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: What am I not understanding about $,

by Athanasius (Archbishop)
on May 01, 2016 at 06:17 UTC ( [id://1161975]=note: print w/replies, xml ) Need Help??


in reply to What am I not understanding about $,

Actually, in this case the space is being added, not by the output field separator ($,), but by the list separator ($"), because the array slice is stringified. To get what you want, you can either (1) set $" to the empty string (not undef, that gives a warning), or (2) not stringify the array slice in the print statement:

16:14 >perl -wE "my @array = qw(abc def ghi jkl mno); print @array[2,4 +], qq{\n};" ghimno 16:14 >

See the entries for $" and $, in perlvar.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1161975]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-20 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found