On Fri, 18 Jun 2004 [EMAIL PROTECTED] wrote:

> All,
>
> Does perl have built in variable names such as in awk?  Here are the ones
> in awk
> I know perl uses ARGV, but what about:
>
> ARGC # of command lines arguments

For that you use scalar(@ARGV).

> FILENAME name of current input file

That's $ARGV.

> FNR record number in current file

I think it's "$.".

> FS controls the input field separator

Well, that's specified using -F if you use the -a and -n or -p (perldoc
perlrun for details). Other than that, you can split a string any way you
want using the split function:

@F = (split/myregex/, $string);

> NF number of fields in current record

scalar(@F) in the above example.

> NR number of records read so far

What's the difference between that and FR?

> OFMT output format for numbers

$#, but see "perldoc perlvar about it".

> OFS out filed separator

$, (or $OFS or $OUTPUT_FIELD_SEPARATOR in English).

> ORS output record separtor

$\ (or $ORS or $OUTPUT_RECORD_SEPARATOR).

> RLENGTH lenght of string matched by match function

There are many variables for getting output out of the match function. You
can use the length() function on them.

> RS controls the input record separator

What does it do?

> SUBSEP subscript separtor
>

Again, I'm not so familiar with awk so I don't know what does it do.

In any case, the Perl philosophy (for most serious things, at least) is
different than awk's. You write your script as a full-fledged program,
where you can use explicit constructs to work with the input and produce
the output. While Perl can be invoked to behave more like awk, it is not
necessarily so.

Regards,

        Shlomi Fish

> thanks again!
>
> Derek B. Smith
> OhioHealth IT
> UNIX / TSM / EDM Teams
> 614-566-4145
>



----------------------------------------------------------------------
Shlomi Fish        [EMAIL PROTECTED]
Home Page:         http://shlomif.il.eu.org/

You are banished! You are banished! You are banished!

Hey? I'm just kidding!

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