[11830] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5430 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 20 13:07:31 1999

Date: Tue, 20 Apr 99 10:01:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 20 Apr 1999     Volume: 8 Number: 5430

Today's topics:
        Missing ] at end of script <bcoffey@policeforum.org>
    Re: Missing ] at end of script <charles@twcny.rr.com>
    Re: Missing ] at end of script <ebohlman@netcom.com>
    Re: Missing ] at end of script <camerond@mail.uca.edu>
    Re: Missing ] at end of script <charles@twcny.rr.com>
        posting from perl to cgi <ours@casema.net>
    Re: Removing elements of an array... <ebohlman@netcom.com>
        SNMP <philip.smeuninx@be.uunet.net>
    Re: Sorting Hashes of Arrays.... <Anthony@Baratta.com>
    Re: T-shirt with potential Perl-logo <e.h.bogart@larc.nasa.gov>
    Re: Top 10 newbie errors? <jeromeo@atrieva.com>
    Re: Wow, thought he'd be much older... <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 20 Apr 1999 11:33:05 -0400
From: Bentley Coffey <bcoffey@policeforum.org>
Subject: Missing ] at end of script
Message-Id: <371C9E31.2BD3DD3C@policeforum.org>

Has anyone ever seen this problem? I've checked thru the Camel books and
haven't found a reason for this. I seem to have written some clean code
designed to take a 4-column, 30000-row table and renormalize it in a
cleaner form: ~300-column, 100-row table. I would have done it in my
only SQL engine---ACCESS---except for its limitations.

How do I fix this?

Compilation error message:
Missing right bracket at reorganizer.pl line 102, at end of line
syntax error at reorganizer.pl line 102, at EOF
Execution of reorganizer.pl aborted due to compilation errors.

Note: in my code, line 102 is the LAST line of code

Reorganizer.pl:
# Intialize
#-------------------------------------------------

#open old output file
open OLDOUT, "sampleoldoutput.csv";

#open new ouput file
open NEWOUT, ">neworgoutput.csv";

#array for input value column headings
@colhead =
("Realization","Solve","BET","R","GL0","DLAB","DELTAM","GA0","DELA","SIG0","GSIGMA","DK","GAMA","M0","TL0","T0","ATRET","Q0","LL0","K0","C1","LAM","C3","C4","A0","A1","B1","B2","PHIK","PHIM","PHITE","A2","FEXOG");

#array for output value column headings
@outputvar = ("Y","M","E","TE","MIU","C","L");

#define number of columns
$numinputvar = 33;
$numoutputvar = 7;

#Write header of new ouput file
#-------------------------------------------------

#Write input column headers
print NEWOUT "$colhead[0]";
$i = 1;
while ($i < $numinputvar)
        {
                print NEWOUT ",$colhead[$i]";
                $i++;
        }

#write output column headers
$i = 0;
while ($i < $numoutputvar)
        {
                $j = 1;
                while ($j < 41)
                        {
                                print NEWOUT ",$outputvar[$i]$j";
                                $j++;
                        {
                $i++;
        }
print NEWOUT "\n";

#Populate the rows of this new output table
#----------------------------------------------------

#read in first line of old output
$line = <OLDOUT>;

#parse string into a list
@elements = split/,/,$line;

#Capture meaningful data
$lastreal = $elements[0];
$value = $elements[3];

#write first part of the first line
print NEWOUT "$lastreal,$value";

#while not EOF
#while (!eof(OLDOUT))
while (<OLDOUT>)
        {
                #read in first line of old output
                $line = <OLDOUT>;

                #parse string into a list
                @elements = split/,/,$line;

                #Capture meaningful data
                $nextreal = $elements[0];
                $value = $elements[3];

                if ($lastreal == $nextreal)
                        {
                                #read in element and write value
                                print NEWOUT ",$value";
                                $lastreal = $nextreal;
                        }
                else
                        {
                                #print end of line and begin a new line
                                print NEWOUT "\n$nextreal,$value";
                                $lastreal = $nextreal;
                        }
        }

#Clean-up
#------------------------------------------------------ 

print NEWOUT "\n";

#close old output file
close OLDOUT;

#close new output file
close NEWOUT;


------------------------------

Date: Tue, 20 Apr 1999 11:50:55 -0400
From: charles <charles@twcny.rr.com>
Subject: Re: Missing ] at end of script
Message-Id: <371CA25F.4428C4F7@twcny.rr.com>

Try compiling with 'perl -c'.  The -c means "compile only".  When I tried your script with that option I got these other errors :

syntax error in file foo.bar at line 56, next 2 tokens "/,"
Search pattern not terminated in file foo.bar at line 56, next char ^?
syntax error in file foo.bar at line 73, next 2 tokens "/,"
Search pattern not terminated in file foo.bar at line 73, next char ^?
syntax error in file foo.bar at line 103, at EOF

In my editor lines 56 and 73 are those splits without parens!



Bentley Coffey wrote:

> Has anyone ever seen this problem? I've checked thru the Camel books and
> haven't found a reason for this. I seem to have written some clean code
> designed to take a 4-column, 30000-row table and renormalize it in a
> cleaner form: ~300-column, 100-row table. I would have done it in my
> only SQL engine---ACCESS---except for its limitations.
>
> How do I fix this?
>
> Compilation error message:
> Missing right bracket at reorganizer.pl line 102, at end of line
> syntax error at reorganizer.pl line 102, at EOF
> Execution of reorganizer.pl aborted due to compilation errors.
>
> Note: in my code, line 102 is the LAST line of code
>
> Reorganizer.pl:
> # Intialize
> #-------------------------------------------------
>
> #open old output file
> open OLDOUT, "sampleoldoutput.csv";
>
> #open new ouput file
> open NEWOUT, ">neworgoutput.csv";
>
> #array for input value column headings
> @colhead =
> ("Realization","Solve","BET","R","GL0","DLAB","DELTAM","GA0","DELA","SIG0","GSIGMA","DK","GAMA","M0","TL0","T0","ATRET","Q0","LL0","K0","C1","LAM","C3","C4","A0","A1","B1","B2","PHIK","PHIM","PHITE","A2","FEXOG");
>
> #array for output value column headings
> @outputvar = ("Y","M","E","TE","MIU","C","L");
>
> #define number of columns
> $numinputvar = 33;
> $numoutputvar = 7;
>
> #Write header of new ouput file
> #-------------------------------------------------
>
> #Write input column headers
> print NEWOUT "$colhead[0]";
> $i = 1;
> while ($i < $numinputvar)
>         {
>                 print NEWOUT ",$colhead[$i]";
>                 $i++;
>         }
>
> #write output column headers
> $i = 0;
> while ($i < $numoutputvar)
>         {
>                 $j = 1;
>                 while ($j < 41)
>                         {
>                                 print NEWOUT ",$outputvar[$i]$j";
>                                 $j++;
>                         {
>                 $i++;
>         }
> print NEWOUT "\n";
>
> #Populate the rows of this new output table
> #----------------------------------------------------
>
> #read in first line of old output
> $line = <OLDOUT>;
>
> #parse string into a list
> @elements = split/,/,$line;
>
> #Capture meaningful data
> $lastreal = $elements[0];
> $value = $elements[3];
>
> #write first part of the first line
> print NEWOUT "$lastreal,$value";
>
> #while not EOF
> #while (!eof(OLDOUT))
> while (<OLDOUT>)
>         {
>                 #read in first line of old output
>                 $line = <OLDOUT>;
>
>                 #parse string into a list
>                 @elements = split/,/,$line;
>
>                 #Capture meaningful data
>                 $nextreal = $elements[0];
>                 $value = $elements[3];
>
>                 if ($lastreal == $nextreal)
>                         {
>                                 #read in element and write value
>                                 print NEWOUT ",$value";
>                                 $lastreal = $nextreal;
>                         }
>                 else
>                         {
>                                 #print end of line and begin a new line
>                                 print NEWOUT "\n$nextreal,$value";
>                                 $lastreal = $nextreal;
>                         }
>         }
>
> #Clean-up
> #------------------------------------------------------
>
> print NEWOUT "\n";
>
> #close old output file
> close OLDOUT;
>
> #close new output file
> close NEWOUT;



------------------------------

Date: Tue, 20 Apr 1999 15:43:33 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Missing ] at end of script
Message-Id: <ebohlmanFAHvoL.GJD@netcom.com>

Bentley Coffey <bcoffey@policeforum.org> wrote:
: Compilation error message:
: Missing right bracket at reorganizer.pl line 102, at end of line
: syntax error at reorganizer.pl line 102, at EOF
: Execution of reorganizer.pl aborted due to compilation errors.

: Note: in my code, line 102 is the LAST line of code

That means that perl came to the last line of your code and found that it 
had seen more left brackets than right brackets.

: #write output column headers
: $i = 0;
: while ($i < $numoutputvar)
:         {
:                 $j = 1;
:                 while ($j < 41)
:                         {
:                                 print NEWOUT ",$outputvar[$i]$j";
:                                 $j++;
:                         {

I'm willing to bet that that left bracket was supposed to be a right bracket.

:                 $i++;
:         }
: print NEWOUT "\n";


------------------------------

Date: Tue, 20 Apr 1999 11:19:34 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: charles <charles@twcny.rr.com>
Subject: Re: Missing ] at end of script
Message-Id: <371CA916.2821EBF3@mail.uca.edu>

[cc'd to c]

charles wrote:
> 
> Try compiling with 'perl -c'.  The -c means "compile only".  When I tried your script with that option I got these other errors :
> 
> syntax error in file foo.bar at line 56, next 2 tokens "/,"

"tokens"? Are you still using perl 4? 

> Search pattern not terminated in file foo.bar at line 56, next char ^?
> syntax error in file foo.bar at line 73, next 2 tokens "/,"
> Search pattern not terminated in file foo.bar at line 73, next char ^?
> syntax error in file foo.bar at line 103, at EOF
> 
> In my editor lines 56 and 73 are those splits without parens!

-- 
Cameron Dorey
camerond@mail.uca.edu


------------------------------

Date: Tue, 20 Apr 1999 12:43:39 -0400
From: charles <charles@twcny.rr.com>
Subject: Re: Missing ] at end of script
Message-Id: <371CAEBB.99EEF7C1@twcny.rr.com>

Thanks for pointing that out, Cameron.  The perl in my path was antiquated.

Cameron Dorey wrote:

> [cc'd to c]
>
> charles wrote:
> >
> > Try compiling with 'perl -c'.  The -c means "compile only".  When I tried your script with that option I got these other errors :
> >
> > syntax error in file foo.bar at line 56, next 2 tokens "/,"
>
> "tokens"? Are you still using perl 4?
>
> > Search pattern not terminated in file foo.bar at line 56, next char ^?
> > syntax error in file foo.bar at line 73, next 2 tokens "/,"
> > Search pattern not terminated in file foo.bar at line 73, next char ^?
> > syntax error in file foo.bar at line 103, at EOF
> >
> > In my editor lines 56 and 73 are those splits without parens!
>
> --
> Cameron Dorey
> camerond@mail.uca.edu



------------------------------

Date: Tue, 20 Apr 1999 17:20:42 -0700
From: "Ours" <ours@casema.net>
Subject: posting from perl to cgi
Message-Id: <7fi60n$b5r$1@news.casema.net>

Hi group.

I was wondering how I can post one value, from a perl-script into another
cgi-script.

Thanks,

MW




------------------------------

Date: Tue, 20 Apr 1999 15:06:29 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Removing elements of an array...
Message-Id: <ebohlmanFAHtyt.2oB@netcom.com>

Federico Abascal <fabascal@gredos.cnb.uam.es> wrote:
: How can I remove an element of an array? If I do this way:
:         undef $array[5];
: does the element $array[6] go to position 5?
: What's the better way to remove an element in a way that the next
: elements go to the previous position?

perldoc -f splice



------------------------------

Date: Tue, 20 Apr 1999 17:47:34 +0200
From: "Philip Smeuninx" <philip.smeuninx@be.uunet.net>
Subject: SNMP
Message-Id: <7fi7i7$nb7$1@nickel.uunet.be>

Hello,

How can I send SNMPGETS in perl???

Philip




------------------------------

Date: Tue, 20 Apr 1999 09:28:18 -0700
From: Anthony Baratta <Anthony@Baratta.com>
Subject: Re: Sorting Hashes of Arrays....
Message-Id: <371CAB22.CFF5FAB8@Baratta.com>

I'll check out the FAQ - didn't see that section when I rummaged through
it. Thanks for the pointer.

-- 
Anthony Baratta
President
KeyBoard Jockeys
                    South Park Speaks Version 3 is here!!!
                       http://www.baratta.com/southpark
                              Powered by Tsunami


------------------------------

Date: Tue, 20 Apr 1999 12:28:18 -0400
From: Ed Bogart <e.h.bogart@larc.nasa.gov>
Subject: Re: T-shirt with potential Perl-logo
Message-Id: <371CAB22.7C97E07A@larc.nasa.gov>

Daniel Pfeiffer wrote:
> 
> Saluton retanoj!
> 
> During my holidays in the Dominican Republ (well -- paradise), I saw
> several people with a T-shirt, that I didn't have too much trouble getting
> for myself. I guess most Perlies would recognize it as having a Perl-logo: it
> shows an @-sign, where the a is replaced by a camel whose hind leg leads to
> the spiral. On the back it has the same logo in big, plus a slogan "where
> it's @".  Besides a copyright ) 1997 RJRTC and an indication "made in China"
> there's no clue as to what it's really about.
> 
That's easy for a good ol' Southern boy. RJRTC stands for R. J. Reynolds
Tobacco Co. who makes Camel cigarettes which are mostly sold in third
world countries. So, RJRTC, camel and Dominican Rep. have nothing to do
with Perl (but I with I had one, even so.)

Ed


------------------------------

Date: Tue, 20 Apr 1999 07:57:35 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: Top 10 newbie errors?
Message-Id: <371C95DF.70C194CE@atrieva.com>

Clinton Pierce wrote:
> "...moving beyond newbie-land..."  But that's not what was asked.

Certainly it is what was asked.  "What are the most common mistakes
newbies make?"  The general answer is "They fail to stop doing the
things that make them newbies."

> Telling new programmers and new Perl users, as a blanket
> recommendation, to "use strict" can have the effect of dampening their
> enthusiasm for the language, and for programming in general.

I disagree.  Strict doesn't increase the learning curve that much, and
the problems it fixes (and therefore aren't encountered) are going to
increase a programmers enthusiasm for the language.  

> Believe me, I'm the last person to spoil a new programmers fun.
> Agreed: "use strict" should be in a programmer's arsenal of debugging
> tools, and coding a project of any size without it is lunacy.

I think this is the rub.  Everyone starts out with "Hello World!", with
ideas of writing large integer factoring engines in three lines or
less.  At what point does a coding project's size warrant stricts use? 
By using it from the beginning, you avoid having to unlearn all the bad
habits you picked up by starting without it.  

For the record, I agree with your assessment that a project of *any*
size without it is madness. :-)

> 
> But using a B&D language can spoil the wonder in simply pasting a
> little bit of code from here-and-there and making the computer do what
> you want.

Pasting a bit of code from here-and-yon does not a programmer make any
more than using strict turns perl into a "B&D" language.  What it does
do is help develop "D" programmers, and that's a Good Thing.

> New programmers have to worry about semicolons, $@&%, and whether
> their brackets match up.

Basic language semantics have little to do with strict.  If you can't
figure these out, you can't write perl at all.  Or C.  Or Java.  Or
awk.  Or ...  

>  Variable scope?  Pttth.

A project of any appreciable size.  Mmmmmm.....  Scope.... 

> No.  Your infants seem to be in 4th-5th grade.  Real Programming
> Infants prefer:
> 
>         $foo="bar";
> 
> The quotes look "familar", and the variable just "pops" into
> existance.  The tough exercise is remembering the "$" on the "foo".

If you wish to make the issue "how I like to use quotes," that's another
thread.  

However, 

my $foo = "bar";  

is no great stretch.  If our newbie can't remember to add $ to his
scalars, warnings should catch it.  And we all love warnings.

> 
> Scope is a big concept for the first few programs.  Do you want them
> blindly declaring all of their variables with my()?  That's what
> you'll wind up with.  Honestly, how many here can remember new Perl 4
> programmers declaring everything with local()...and still doing it
> after Perl 5 came around?  Show of hands?  There's a lot of them
> blindly repeating something they don't understand.

The odds that they will understand by doing it, while taking it on faith
that it's right is far greater than the odds they will understand by
*not* doing it, and taking it on faith that they are doing it right.

> I think promoting supersticious programming like this is a Bad Thing.

I think promoting good programming habits (especially in new
programmers) like this is a Good Thing.

> Let them have "use strict", when they need it.

Right Outta Da Box!


-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


------------------------------

Date: Tue, 20 Apr 1999 09:29:54 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Wow, thought he'd be much older...
Message-Id: <371CAB82.8B1159F9@mail.cor.epa.gov>

Damian Conway wrote:
> 
> "Matthew O. Persico" <mpersico@erols.com> writes:
> 
> >Larry, that is. Somehow, I pictured a graying professorial look right
> >down to patches on the elbows. The cover of Linux Journal shows me
> >differently.
> 
> Ah, but you should see the self-portrait in his study!
> 
> Damian

Then, given your first name, I'll find it 'ominous' that you knew.  :-)

David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


------------------------------

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 5430
**************************************

home help back first fref pref prev next nref lref last post