Sonia Hamilton wrote:

I'm doing this using awk and getting correct results:

$ dirs -v | awk 'BEGIN { OFS=":"; ORS=" "; } ; { print $1,$2 }'
0:/home 1:/etc 2:~

I'm trying to do this using Perl (as gnu awk not available on target
system), and getting stuck:

$ dirs -v | perl -wnla -e 'BEGIN {$\=' '; } ; ($A,$B)[EMAIL PROTECTED]; print 
"$A:$B";
 '
syntax error at -e line 1, at EOF
BEGIN not safe after errors--compilation aborted at -e line 1.

Try this:

dirs -v | perl -wnla -e 'BEGIN {$\=" "; $,=":"} print @F;'; echo

ie I'm trying to set the OFS (output field separator $\). Any ideas what
I'm doing wrong? And how do I set the ORS (output record separator) in
Perl (rather than doing print "$A:$B")?

ORS is $,

Source:

perldoc perlvar


cheers
rickw



--
_________________________________
Rick Welykochy || Praxis Services

Q: What's the difference between a software sales person and a car sales person?
A: With a car sales person there is a slight chance that he actually knows how 
to drive.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to