On Sat, 2002-11-23 at 04:50, John W. Krahn wrote:
> Mike wrote:
> > 
> > On Fri, 2002-11-22 at 05:44, John W. Krahn wrote:
> > > Mike wrote:
> > > >
> > > > I'm getting confused - I have the following script
> > > >
> > > > open(DESK,"gtkdoclist") or die "cant open";
> > > > @desk1=<DESK>;
> > > > foreach $desk1 (@desk1){
> > > > chomp $desk1;
> > > > print "$desk1\n";
> > > > $gtkdoc1=system("grep -h gtk_doc_min_version= $desk1");
> > > > chomp $desk1;
> > > > print "$gtkdoc1";
> 
> Did you try the code that I posted here in my last reply?

I modified my code to use backticks, when the code worked up to that
point - thanks.

> 
> > Solved the immediate problem but now from this script
> > 
> > #!/usr/bin/perl -w
> > open(DESK,"gtkdoclist") or die "cant open";
>                              ^^^^^^^^^^^^^^
> You should include the actual file name and the $! variable in the error
> message.
> 

I know I should (and would if the file handle was not being opened -
noting after this would work if it wasn't)

> > @desk1=<DESK>;
> > foreach $desk1 (@desk1){
> > print "$desk1";
>         ^      ^
> The quotation marks are not required as the print function will convert
> everything it prints to a string.
> 
> 
> > $desk3=$desk1;
> > $gtkdoc1=`grep gtk_doc_min_version= $desk1`;
> 
> Do you understand what the backticks do in a scalar context?
> 

I think so - ie: feeding the result back to perl ($gtkdoc1 above)

> > chop $gtkdoc1;
> > chomp $gtkdoc1;
> > chomp $gtkdoc1;
> 
> Do you understand what chop() and chomp() do?
> 

yep - just making sure

> > print "$gtkdoc1\n";
> > @gtkdoc2=split /=/, $gtkdoc1;
> > print "$gtkdoc2[1]\n";
> > $gtkdoc3=$gtkdoc2[1];
> > $mult='10';
> > $gtkdoc4=$gtkdoc3 * $mult;# this is the error
> > print $gtkdoc3
>                 ^
> The actual error is here.  Something is missing.
> 
> 
> > $gtkdoc5=$gtkdoc1;
> > 
> > gives the following error
> > 
> > atk/configure.in
> > gtk_doc_min_version=0.6
> > 0.6
> > Filehandle main::0.6 never opened at ./gtkdocchk line 17, <DESK> line
> > 41.
> > 
> > as you can see (0.6) my var for calculation seems in scope but
> > calculation is not taking place
> 
> That is because the result of the multiplication is stored in a
> different variable then the one you are printing.
> 

sorry about the typo in the last print. I am still trying to work out
where the error is coming from.

more errors follow to show more of what seems to be happening

glib/configure.in
gtk_doc_min_version=0.6
0.6
Filehandle main::6 never opened at ./gtkdocchk line 17, <DESK> line 41.
glib/configure
gtk_doc_min_version=0.6
0.6
Filehandle main::6 never opened at ./gtkdocchk line 17, <DESK> line 41.
gnome-panel/configure.in
gtk_doc_min_version=0.9
0.9
Filehandle main::9 never opened at ./gtkdocchk line 17, <DESK> line 41

The Filehandle main error seems to be referencing the first digit to the
right of the decimal point

As I understand it up to my problem is

I split $gtkdoc1 - OK
I print $gtkdoc2[1] - OK
I assign this to $gtkdoc3 -Ok
I print this to be sure (0.6 or 0.9 or 0.7 etc) -Ok

then I try to assign to gtkdoc4 a multiplication of $gtkdoc3 * $mult,
which is where it goes toes up

> 
> John
> -- 
> use Perl;
> program
> fulfillment
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to