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"; > > however the output is this > (notice the zeros at the start of line) > atk/configure.in > gtk_doc_min_version=0.6 > 0atk/configure > gtk_doc_min_version=0.6 > 0at-spi/configure.in > gtk_doc_min_version=0.6 > 0at-spi/configure > gtk_doc_min_version=0.6 > 0bonobo-activation/configure.in > gtk_doc_min_version=0.6 > > the source file looks like this > > atk/configure.in > atk/configure > at-spi/configure.in > at-spi/configure > bonobo-activation/configure.in > bonobo-activation/configure > > As you can see there are extraneous returns and zeros - anyone any idea > where they are coming from?
Yes, system() returns the exit code of the command you are running. You are assigning this to a variable and then printing it out. my $file = 'gtkdoclist'; open DESK, $file or die "Cannot open $file: $!"; while ( my $desk = <DESK> ) { chomp $desk; print "$desk\n"; if ( open GTKDOC, $desk ) { print grep /gtk_doc_min_version=/, <GTKDOC>; } } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]