Folks,

would you please explain me one string of code I could node
understand?
Here it is:
$ perl -ne 'chomp; $fmt = "%-10s  %-10s  %s\n";
>           if ($ARGV eq "name") {$x{$_}++}
>           elsif (/^ALTER TABLE (.*)/ and defined $x{$1}) {$in=1; $tbl=$1}
>           elsif ($in and /^ADD\s*\(\s*(\w+)\s*(.*?),/) 
> {printf($fmt,$tbl,$1,$2)}
>           elsif ($in and /^\s*(\w+)\s*(.*?)\s*\);/) {printf($fmt,$tbl,$1,$2)}
>           elsif (/^\s*$/) {$in=0}
>          ' name temp

(here is the whole story: 
http://www.unix.com/shell-programming-scripting/139870-shell-script-using-loop-3.html).

Loop happens because of -n switch, correct?

Could you please explain me that part:
>           if ($ARGV eq "name") {$x{$_}++} - what happens here? And what is 
> $in for?

Thanks a lot in advance

RT


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to