[Gllug] Perl Newbie question
Dean
dean.wilson3 at virgin.net
Wed Sep 5 09:54:26 UTC 2001
On Wed, Sep 05, 2001 at 10:44:01AM +0100, Matthew Bunter wrote:
> @food=("apples","pears","eels");
> print"@food";
> print @food; # doesn't put spaces in between scalars
> The first print statement prints the scalars separated by a space. Does it therefore mean that the $" variable is a blank space?
Yes.
> If so to get the scalars printed separated by # do I set $"=#?
Basically yes. But only in double quoted strings.
You'll probably want to only change that for a little section of your
program so you would normally do something like:
{
local $";
$" = ":::";
print "@food";
}
So that $" is only effected in that small scope and returns to normal after
that block. The other way that might be easier to read is to do this:
print join(":::", @food);
Its a little more verbose but easier for non Perl coders to pick up and it
avoids the punctuation variables.
> Before you say try it, I have. I am in France with a French keyboard and I get 3 when I set the $"=#, please set my mind straight. To choose 3 you have to do shift as well - you guys can smile I have to suffer!
I had to code on a German keyboard at the LBW it's a night mare. Perl has
too many punctuations needs for heathen keyboards ;)
> Can't remember where the # is on a GB keyboard - can someone remind me. I've searched the whole building and no-one has a GB keyboard!
Next to the return key, between the right bracket and the shift key.
--
Profanity is the one language all programmers understand
--- Anon
--
Gllug mailing list - Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug
More information about the GLLUG
mailing list