perl -e and bash

Discussion in 'Perl Misc' started by Rob Beattie, Apr 8, 2004.

  1. Rob Beattie

    Rob Beattie Guest

    hi,
    i'm just starting out with perl and have come across the well known
    dos problem when running the following
    perl -e 'print "hi \n";'

    I've tried to read up on a solution for this and have seen suggestions
    regarding using a bash shell. Where can I download this(cygwin.com?)
    and how much space will it take up on my hard drive. I've checked at
    cygwin and read that it will require 800MB of storage. This seems to
    be a bit excessive to me.
    So are there any windows users out there who has gone through this
    route?
     
    Rob Beattie, Apr 8, 2004
    #1
    1. Advertising

  2. Rob Beattie

    Sisyphus Guest

    Rob Beattie wrote:
    > hi,
    > i'm just starting out with perl and have come across the well known
    > dos problem when running the following
    > perl -e 'print "hi \n";'
    >


    There's also the well known solution to this problem:
    perl -e "print \"hi \n\";"

    (Just in case you were unaware of it :)

    Cheers,
    Rob

    --
    To reply by email u have to take out the u in kalinaubears.
     
    Sisyphus, Apr 8, 2004
    #2
    1. Advertising

  3. Rob Beattie

    Joe Smith Guest

    Rob Beattie wrote:

    > hi,
    > i'm just starting out with perl and have come across the well known
    > dos problem when running the following
    > perl -e 'print "hi \n";'
    >
    > I've tried to read up on a solution for this and have seen suggestions
    > regarding using a bash shell. Where can I download this(cygwin.com?)


    Yes, http://www.cygwin.com/ is where you'll find the installer.

    > and how much space will it take up on my hard drive. I've checked at
    > cygwin and read that it will require 800MB of storage.


    Cygwin's setup.exe does not install _everything_ by default.
    I've got more than just the default and 'du -k' on my C:\cygwin shows this:

    57920 bin
    1821 etc
    19315 home
    75738 lib
    22 tmp
    4961 usr/doc
    7467 usr/include
    16517 usr/info
    397 usr/local
    2762 usr/man
    987 usr/sbin
    72015 usr/share
    3392 usr/src
    442 usr/ssl
    256 var
    264 megabytes total

    It's a full-fledged Unix-like universe inside your Win32 box.
    -Joe
     
    Joe Smith, Apr 8, 2004
    #3
  4. Rob Beattie

    John Bokma Guest

    Sisyphus wrote:

    > Rob Beattie wrote:
    >
    >> hi,
    >> i'm just starting out with perl and have come across the well known
    >> dos problem when running the following
    >> perl -e 'print "hi \n";'

    >
    >
    > There's also the well known solution to this problem:
    > perl -e "print \"hi \n\";"
    >
    > (Just in case you were unaware of it :)


    or

    perl -e "print qw(hi \n);"

    --
    John personal page: http://johnbokma.com/

    Experienced Perl / Java developer available - http://castleamber.com/
     
    John Bokma, Apr 8, 2004
    #4
  5. John Bokma <> wrote:
    > Sisyphus wrote:
    >> Rob Beattie wrote:
    >>


    >>> dos problem when running the following
    >>> perl -e 'print "hi \n";'

    >>
    >>
    >> There's also the well known solution to this problem:
    >> perl -e "print \"hi \n\";"
    >>
    >> (Just in case you were unaware of it :)

    >
    > or
    >
    > perl -e "print qw(hi \n);"

    ^^
    ^^ you meant qq() instead of qw()


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Apr 8, 2004
    #5
  6. Rob Beattie

    Rob Beattie Guest

    On Thu, 8 Apr 2004 08:09:47 -0500, Tad McClellan
    <> wrote:

    >John Bokma <> wrote:
    >> Sisyphus wrote:
    >>> Rob Beattie wrote:
    >>>

    >
    >>>> dos problem when running the following
    >>>> perl -e 'print "hi \n";'
    >>>
    >>>
    >>> There's also the well known solution to this problem:
    >>> perl -e "print \"hi \n\";"
    >>>

    I did not know about this one

    >>> (Just in case you were unaware of it :)

    >>
    >> or
    >>
    >> perl -e "print qw(hi \n);"

    > ^^
    > ^^ you meant qq() instead of qw()


    but I have heard of perl -e "print qq(hi \n);"
    it is just that I can't understand the explanantion behind it.
    If I applied the following rules:-

    replace ' with "
    use whatever the original two " enclosed as an argument for qq()

    would that be the case here?
     
    Rob Beattie, Apr 8, 2004
    #6
  7. Rob Beattie <rob@/remove/ghosh.co.uk> wrote:
    > On Thu, 8 Apr 2004 08:09:47 -0500, Tad McClellan
    ><> wrote:
    >>John Bokma <> wrote:



    >>> perl -e "print qw(hi \n);"

    >> ^^
    >> ^^ you meant qq() instead of qw()

    >
    > but I have heard of perl -e "print qq(hi \n);"
    > it is just that I can't understand the explanantion behind it.



    What explanation was that?

    Was it the one in the "Quote and Quote-like Operators" in perlop.pod?


    > If I applied the following rules:-
    >
    > replace ' with "



    That's DOS stuff. No Perl there.


    > use whatever the original two " enclosed as an argument for qq()
    >
    > would that be the case here?



    If you don't want to have to backslash double quotes, then write
    your Perl code without any double quotes in it.


    Instead of starting a string with

    "

    start it with

    qq( # or: qq/ qq{ qq. qq| ...

    instead of ending the string with

    "

    end it with

    ) # or: / { . | ...


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Apr 9, 2004
    #7
  8. Rob Beattie

    Sisyphus Guest

    Rob Beattie wrote:

    > If I applied the following rules:-
    >
    > replace ' with "
    > use whatever the original two " enclosed as an argument for qq()
    >
    > would that be the case here?
    >


    That's right.

    Cheers,
    Rob

    --
    To reply by email u have to take out the u in kalinaubears.
     
    Sisyphus, Apr 9, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Goblin
    Replies:
    1
    Views:
    8,499
  2. William Park

    (patch for Bash) GTK+2 + Bash

    William Park, Jul 11, 2005, in forum: XML
    Replies:
    3
    Views:
    2,320
    William Park
    Jul 14, 2005
  3. Peter Steele

    bash shell script - perl conversion

    Peter Steele, Apr 2, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    101
    Paul Lalli
    Apr 2, 2004
  4. ecureuil

    with bash : hostname -d - with perl?

    ecureuil, May 25, 2006, in forum: Perl Misc
    Replies:
    10
    Views:
    216
    Dr.Ruud
    May 25, 2006
  5. David Williams

    bash and perl

    David Williams, Feb 18, 2008, in forum: Perl Misc
    Replies:
    7
    Views:
    361
    David Williams
    Feb 22, 2008
Loading...

Share This Page