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?


> 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.


> @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?


> chop $gtkdoc1;
> chomp $gtkdoc1;
> chomp $gtkdoc1;

Do you understand what chop() and chomp() do?


> 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.



John
-- 
use Perl;
program
fulfillment

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

Reply via email to