generating perl code from awk

F

Farhat Habib

Hi,

I have rather simple awk script which I would like to convert to Perl. I
am using a2p but unfortunately it gives me a syntax error.

----
syntax error in file tntvenn.awk at line 22
Translation aborted due to syntax errors.
----


for ( char in chars )
{ common = 1 ; out = ""
for ( name in names )
=> if ( (name,char) in data )
out = out char ": " data[name,char] "\n"
else
common = 0
if ( common )
print out
}
}

Line 22 is the line starting with =>

Any clues as to what's problem?

Thanks,
-F
 
A

anno4000

Farhat Habib said:
Hi,

I have rather simple awk script which I would like to convert to Perl. I
am using a2p but unfortunately it gives me a syntax error.

----
syntax error in file tntvenn.awk at line 22
Translation aborted due to syntax errors.
----


for ( char in chars )
{ common = 1 ; out = ""
for ( name in names )
=> if ( (name,char) in data )
out = out char ": " data[name,char] "\n"
else
common = 0
if ( common )
print out
}
}

Line 22 is the line starting with =>

That is incorrect awk code. The "in" keyword is only valid in a "for"
statement, not with "if".

Anno
 
F

Farhat Habib

Farhat Habib said:
Hi,

I have rather simple awk script which I would like to convert to Perl. I
am using a2p but unfortunately it gives me a syntax error.

----
syntax error in file tntvenn.awk at line 22
Translation aborted due to syntax errors.
----


for ( char in chars )
{ common = 1 ; out = ""
for ( name in names )
=> if ( (name,char) in data )
out = out char ": " data[name,char] "\n"
else
common = 0
if ( common )
print out
}
}

Line 22 is the line starting with =>


That is incorrect awk code. The "in" keyword is only valid in a "for"
statement, not with "if".

It seems to work with GNU awk. Is there a replacement for this that
would work with a2p?

Thanks,

-F
 
A

anno4000

Farhat Habib said:
[...]
That is incorrect awk code. The "in" keyword is only valid in a "for"
statement, not with "if".

It seems to work with GNU awk. Is there a replacement for this that
would work with a2p?

Good question, wrong newsgroup.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top