> From: Beau E. Cox <beau.e....@gmail.com>
> Subject: Re: I'm sure this is a common question, but I can't find the  
> solution.
> To: geeksatla...@yahoo.com
> Date: Saturday, March 14, 2009, 10:51 PM
> Ron,
> 
> On Sat, Mar 14, 2009 at 7:28 PM, Ron Smith
> <geeksatla...@yahoo.com> wrote:
> >
> > Hello all,
> >
> > How do you print elements of an array, each on its own
> line, in a Windows' console?
> >
> > I'm doing the following:
> >
> > E:\My Documents>perl -e "use
> ExtUtils::Installed; my $inst =
> ExtUtils::Installed->new(); my @modules =
> $inst->modules(); print @modules"
> >
> > it returns:
> >
> >
> Archive::TarArchive::ZipArray::CompareAutoLoaderCPANCPAN::ChecksumsCPAN::DistnameInfo
> ...etc.
> >
> > I need:
> >
> > Archive::Tar
> > Archive::Zip
> > Array::CompareAutoLoaderCPAN
> > CPAN::Checksums
> > CPAN::DistnameInfo ...etc.
> >
> > I tried "\n", '\n' and a
> 'foreach' loop, but nothing I do seems to work.
> ..any suggestions?
> >
> 
> Use the "join' command to join the elements of the
> array with "\n":
> 
> perl -e "use ExtUtils::Installed; my $inst =
> ExtUtils::Installed->new(); my @modules =
> $inst->modules(); print join
> \"\n\",@modules,
> "\n\""

Yes, I tried 'join' also but ran into the following message on using more than 
1 set of double quotes:

String found where operator expected at -e line 1, at end of line
        (Missing semicolon on previous line?)
Can't find string terminator '"' anywhere before EOF at -e line 1.

And, when I tried single quotes, I got:

Backslash found where operator expected at -e line 1, near "'\n\',@modules, '\"
        (Missing operator before \?)
Backslash found where operator expected at -e line 1, near "n\"
syntax error at -e line 1, near "'\n\',@modules, '\"
Can't find string terminator "'" anywhere before EOF at -e line 1.


Ron Smith
geeksatla...@yahoo.com

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