From: J�rgen Exner on
"Gerry Ford" <gerry(a)nowhere.ford> wrote:

[shortened to key lines]
>my @list1 = qw( Mon Tu Wed);
>print @list1;
>
>Perl is so idiomatic, it makes me scream. The syntax for the print
>statement is:
>print LIST
>How this doesn't fit the bill is beyond me.
>print @list1;

Huh??? What do you mean?
That print statement prints exactly the elements of that list. What did
you expect it to print?

jue

>
>I find no example of printing a list in the camel book. It does have
>print reverse sort map (1c) keys %hash;
From: Uri Guttman on
>>>>> "JE" == J�rgen Exner <jurgenex(a)hotmail.com> writes:

JE> "Gerry Ford" <gerry(a)nowhere.ford> wrote:
JE> [shortened to key lines]
>> my @list1 = qw( Mon Tu Wed);
>> print @list1;
>>
>> Perl is so idiomatic, it makes me scream. The syntax for the print
>> statement is:
>> print LIST
>> How this doesn't fit the bill is beyond me.
>> print @list1;

JE> Huh??? What do you mean?
JE> That print statement prints exactly the elements of that list. What did
JE> you expect it to print?

see my recent reply to this. my bet is it is the typical missing
newline/stdout buffering issue. note that @list1 has no newlines nor
does the built up array. and he never showed the output, just how he
collected it.

uri

--
Uri Guttman ------ uri(a)stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
From: Gerry Ford on

"Uri Guttman" <uri(a)stemsystems.com> wrote in message
news:x78wz6tscj.fsf(a)mail.sysarch.com...
>>>>>> "JE" == J�rgen Exner <jurgenex(a)hotmail.com> writes:
>
> JE> "Gerry Ford" <gerry(a)nowhere.ford> wrote:
> JE> [shortened to key lines]
> >> my @list1 = qw( Mon Tu Wed);
> >> print @list1;
> >>
> >> Perl is so idiomatic, it makes me scream. The syntax for the print
> >> statement is:
> >> print LIST
> >> How this doesn't fit the bill is beyond me.
> >> print @list1;
>
> JE> Huh??? What do you mean?
> JE> That print statement prints exactly the elements of that list. What
> did
> JE> you expect it to print?
>
> see my recent reply to this. my bet is it is the typical missing
> newline/stdout buffering issue. note that @list1 has no newlines nor
> does the built up array. and he never showed the output, just how he
> collected it.

I simply can't see what's wrong with this:
#!/usr/bin/perl -w

use strict;

my $killrc = "sample.killrc";
my @filter;
my @list1 = qw( Mon Tu Wed);
open(FILE, "<$killrc") and do {
@filter = ();
foreach (<FILE>) {
chomp; length or next; /^#/o and next;
my $pat; eval '$pat = qr/$_/' or do {prompt $@; next};
push @filter, $pat;
}
close(FILE);

}
print @filter;
print @list1;

# perl mats5.pl 2>text50.txt >text51.txt
__END__

Perl.exe says:
syntax error at mats5.pl line 18, near "print"
Execution of mats5.pl aborted due to compilation errors.

There's no output to show. Braces look matched. How does a person invoke
the debugger?

--
"Life in Lubbock, Texas, taught me two things: One is that God loves you
and you're going to burn in hell. The other is that sex is the most
awful, filthy thing on earth and you should save it for someone you love."

~~ Butch Hancock


From: Jim Cochrane on
On 2008-04-22, Gerry Ford <gerry(a)nowhere.ford> wrote:
>
> "Uri Guttman" <uri(a)stemsystems.com> wrote in message
> news:x78wz6tscj.fsf(a)mail.sysarch.com...
>>>>>>> "JE" == J�rgen Exner <jurgenex(a)hotmail.com> writes:
>>
>> JE> "Gerry Ford" <gerry(a)nowhere.ford> wrote:
>> JE> [shortened to key lines]
>> >> my @list1 = qw( Mon Tu Wed);
>> >> print @list1;
>> >>
>> >> Perl is so idiomatic, it makes me scream. The syntax for the print
>> >> statement is:
>> >> print LIST
>> >> How this doesn't fit the bill is beyond me.
>> >> print @list1;
>>
>> JE> Huh??? What do you mean?
>> JE> That print statement prints exactly the elements of that list. What
>> did
>> JE> you expect it to print?
>>
>> see my recent reply to this. my bet is it is the typical missing
>> newline/stdout buffering issue. note that @list1 has no newlines nor
>> does the built up array. and he never showed the output, just how he
>> collected it.
>
> I simply can't see what's wrong with this:
> #!/usr/bin/perl -w
>
> use strict;
>
> my $killrc = "sample.killrc";
> my @filter;
> my @list1 = qw( Mon Tu Wed);
> open(FILE, "<$killrc") and do {
> @filter = ();
> foreach (<FILE>) {
> chomp; length or next; /^#/o and next;
> my $pat; eval '$pat = qr/$_/' or do {prompt $@; next};
> push @filter, $pat;
> }
> close(FILE);
>

Change:
> }

to:
};

(i.e., missing a ';' - and your code could be formatted better)

> print @filter;
> print @list1;
>
> # perl mats5.pl 2>text50.txt >text51.txt
> __END__
>
> Perl.exe says:
> syntax error at mats5.pl line 18, near "print"

The compiler was pointing pretty much right at the problem.


--

From: J�rgen Exner on
"Gerry Ford" <gerry(a)nowhere.ford> wrote:
[Partially rearragned for better reading flow]
>"Uri Guttman" <uri(a)stemsystems.com> wrote in message
>>>>>>> "JE" == J�rgen Exner <jurgenex(a)hotmail.com> writes:
>> JE> "Gerry Ford" <gerry(a)nowhere.ford> wrote:
>> JE> [shortened to key lines]
>> >> my @list1 = qw( Mon Tu Wed);
>> >> print @list1;
>> >>
>> >> Perl is so idiomatic, it makes me scream. The syntax for the print
>> >> statement is:
>> >> print LIST
>> >> How this doesn't fit the bill is beyond me.
>> >> print @list1;
>>
>> JE> Huh??? What do you mean?
>> JE> That print statement prints exactly the elements of that list. What
>> did
>> JE> you expect it to print?
>>
>> see my recent reply to this. my bet is it is the typical missing
>> newline/stdout buffering issue. note that @list1 has no newlines nor
>> does the built up array. and he never showed the output, just how he
>> collected it.

>Perl.exe says:
>syntax error at mats5.pl line 18, near "print"
>Execution of mats5.pl aborted due to compilation errors.

Man, dude!!! How are we supposed to guess??? You could have told us
that your beef is not with the functionality of print() but with a
syntax error in that program! Thank you very much for throwing around
red herrings.

>I simply can't see what's wrong with this:

You got some 'intesting' ways of doing things. I know, there is more
than one way to do things, but your style is kind of pushing it

>#!/usr/bin/perl -w

Better to use
use warnings;
>use strict;
>
>my $killrc = "sample.killrc";
>my @filter;
>my @list1 = qw( Mon Tu Wed);
> open(FILE, "<$killrc") and do {

The more standard way would be
open (FILE, "<", $killrc) or die ("Cannot open $killrc: $!";

> @filter = ();
> foreach (<FILE>) {
> chomp; length or next; /^#/o and next;

Probably it is just me, but I have an strong adversion against mixing
expressions and flow controll in such a way. I would write it as
next unless length;
next if /^#/o;
IMNSHO this is _much_ easier to read and understand.

> my $pat; eval '$pat = qr/$_/' or do {prompt $@; next};

And this is where your unorthodox style bites you. Did you really mean
to eval() the whole rest of the line? Because the argument to eval is
indeed
qr/$_/' or do {prompt $@; next}
I suppose you meant to eval only the
qr/$_/'
Solution: enclose the argument to eval in paranthesis and the mysterious
syntax error is gone:

my $pat; eval ('$pat = qr/$_/') or do {prompt $@; next};

However, I wonder what you are trying to achive by using eval in the
first place. I don't see any need for it.

> push @filter, $pat;
> }
> close(FILE);
>
>}
>print @filter;
>print @list1;

jue