badrinath chitrala wrote:
> Hi

Hello,

> Can sombody hepl me in the below prog
> I could not get any  output

What output were you expecting to get?  What input did you give your program?

> please tell me the mistake i hav done and where
> also suggest me how to go with this
> 
> my $lineno;
> my $current =3D "";

$ perl -e'my $current =3D "";'
Bareword found where operator expected at -e line 1, near "3D"
        (Missing operator before D?)
String found where operator expected at -e line 1, near "D """
        (Do you need to predeclare D?)
syntax error at -e line 1, near "3D "
Execution of -e aborted due to compilation errors.

> while(<>){
> if($current ne $ARGV){
>     $current =3D $ARGV;

$ perl -e'$current =3D $ARGV;'
Bareword found where operator expected at -e line 1, near "3D"
        (Missing operator before D?)
syntax error at -e line 1, near "3D "
Execution of -e aborted due to compilation errors.

> print "\n\t\tFile: $ARGV\n\n";
> $lineno=3D1;

$ perl -e'$lineno=3D1;'
Bareword found where operator expected at -e line 1, near "3D1"
        (Missing operator before D1?)
syntax error at -e line 1, near "3D1"
Execution of -e aborted due to compilation errors.

> }
> print $lineno++;
> print ": $_";
> }

It looks like you have to convert your program from quoted-printable to plain
text.

You don't need the $lineno variable as perl provides one for you:

my $current;

while ( <> ) {
    if ( $. == 1 ) {
        print "\n\t\tFile: ", ( $current = $ARGV ), "\n\n";
        }
    print "$.: $_";
    }

__END__



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to