in reply to one line perl code

Probably the easiest way is to give Perl an argument, like this:
cat file | perl -n0e 'BEGIN{$var = shift} #more code' myvar
Then $var will contain the value 'myvar'. You might also use an environment variable accessible via the %ENV hash, like this:
VAR=myvar; export VAR; cat file | perl -n0e 'BEGIN{$var = $ENV{VAR}} # +more code'
I hope this is a useful answer to your question.

Replies are listed 'Best First'.
Re: Re: one line perl code
by perlisfun (Sexton) on May 08, 2002 at 21:04 UTC
    Thank you very much. It really works. Your support makes me like perl even more. I can't wait that day i can help other people too. Have a nice day!