On Sun, Mar 15, 2009 at 01:46, David Christensen <dpchr...@holgerdanske.com> wrote: > Ron Smith wrote: >> How do you print elements of an array, each on its own line, in a >> Windows' console? > > This works under Cygwin: > > perl -e 'use ExtUtils::Installed; my $inst = > ExtUtils::Installed->new(); my @modules = $inst->modules(); print join > "\n", @modules' > > Notes: > > 1. Single quotes around the script to be evaluated; double quotes > around the newline escape. snip
This is shell dependent, and unfortunately the standard Windows shell (cmd.exe) does not follow the sh syntax. Single quotes are not allowed as quotes and double quotes do not interpolate values. Also $ is not how variables are named. If you want to use double quotes in a commandline program on Windows you must use the generic interpolating quote construct: qq//. perl -MExtUtils::Installed -e "print join qq/\n/, ExtUtils::Installed->new->modules" One of the Windows shell's quirks is that it always appends a line end to a programs last line, so this works fine there, but it would leave the next shell prompt on the same line in sh based shells. Since I normally use sh based shells I am more likely to write perl -MExtUtils::Installed -le 'print for ExtUtils::Installed->new->modules' -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/