Then $var will contain the value 'myvar'. You might also use an environment variable accessible via the %ENV hash, like this:cat file | perl -n0e 'BEGIN{$var = shift} #more code' myvar
I hope this is a useful answer to your question.VAR=myvar; export VAR; cat file | perl -n0e 'BEGIN{$var = $ENV{VAR}} # +more code'
In reply to Re: one line perl code
by thelenm
in thread one line perl code
by perlisfun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |