Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Is an empty block not a block?

by chas (Priest)
on Nov 18, 2005 at 22:18 UTC ( #509980=note: print w/replies, xml ) Need Help??

in reply to Re: Is an empty block not a block?
in thread Is an empty block not a block?

But if so, why is a semicolon necessary. It isn't if the hashref isn't empty as in:
{blah, "blah"} print "This is fine\n";

I don't see why being empty changes anything essential.
Perhaps in the empty case, perl doesn't know what it is, and that's the problem...
(I guess {blah, "blah"} is considered to be a hashref; I don't know what else it would be...)

Replies are listed 'Best First'.
Re^3: Is an empty block not a block?
by eric256 (Parson) on Nov 18, 2005 at 23:00 UTC

    Actualy {blah, "blah"} is considered a block. See below for proof. ;). Perl is trying to be smart and guessing on what exactly {} is based on context. {} makes lots of since as a hash ref but very little as a block. {blah, "blah"}is usefull as a block while my $x = {blah, "blah"}; is most probalby a hashref and treated that way.

    C:\Perl\test>perl -e"{test,'blah'} print 'hello'"; hello C:\Perl\test>perl -e"{test,'blah', print '1'} print 'hello'"; 1hello

    Eric Hodges $_='y==QAe=e?y==QG@>@?iy==QVq?f?=a@iG?=QQ=Q?9'; s/(.)/ord($1)-50/eigs;tr/6123457/- \/|\\\_\n/;print;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://509980]
[LanX]: Apocalypse Wow
[Corion]: Yeah, FF isn't great but Chrome isn't great either. They added some features to the devtools but broke (at least since yesterday) sending custom headers and overriding the UA header
[Corion]: I guess I have to dump the JSON commands I send and file a bug report with the Chromium devs

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2017-10-17 12:41 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (230 votes). Check out past polls.