Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Simple Chomping question

Expand Messages
  • Octavian Rasnita
    Have you tried: chomp @array; Teddy, Teddy s Center: http://teddy.fcc.ro/ Email: orasnita@home.ro ... From: Dustin Smith AKA GIDustin
    Message 1 of 2 , Feb 2 7:39 PM
    • 0 Attachment
      Have you tried:

      chomp @array;

      Teddy,
      Teddy's Center: http://teddy.fcc.ro/
      Email: orasnita@...

      ----- Original Message -----
      From: "Dustin Smith AKA GIDustin" <dustin@...>
      To: <perl-beginner@yahoogroups.com>
      Sent: Monday, February 03, 2003 12:47 AM
      Subject: [PBML] Simple Chomping question


      I have an array, and each element has a newline at the end. How can I get
      rid
      of the newline after each element without making a loop to rebuild each
      element?

      I was hoping that @data = chomp(@data); would work, but it didnt appear to.

      Thanks

      GIDustin

      --
      My Home Page: http://www.gidustin.net
      Alternate: http://www.civ3files.com
      --
      When NASA first started sending up astronauts, they quickly discovered that
      ballpoint pens would not work in zero gravity. To combat the problem, NASA
      scientists spent a decade and 12 Billion Dollars to develop a pen that
      writes
      in zero gravity, upside down, underwater, on almost any surface including
      glass
      and at temperatures ranging from below freezing to 300C.

      The Russians just used a pencil.
      --
      The 10 Commandments consit of 279 words.
      The Declaration of Independence is 300 words long.
      The EU Ordinance on the Import of Caramel Sweets consists of 25911 words...

      Unsubscribing info is here:
      http://help.yahoo.com/help/us/groups/groups-32.html

      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • Franki
      Thats a good question... I would imagine that chomp @array would not have the desired result. so I think this: foreach my $item (@array) { $item = chomp $item;
      Message 2 of 2 , Feb 2 10:11 PM
      • 0 Attachment
        Thats a good question...

        I would imagine that chomp @array would not have the desired result.

        so I think this:

        foreach my $item (@array)
        {
        $item = chomp $item;
        }

        would do the job easily enough...

        but wouldn't it be easier to chomp the data before you put it in the
        array???

        rgds

        Frank

        -----Original Message-----
        From: Octavian Rasnita [mailto:orasnita@...]
        Sent: Monday, 3 February 2003 11:40 AM
        To: perl-beginner@yahoogroups.com
        Subject: Re: [PBML] Simple Chomping question


        Have you tried:

        chomp @array;

        Teddy,
        Teddy's Center: http://teddy.fcc.ro/
        Email: orasnita@...

        ----- Original Message -----
        From: "Dustin Smith AKA GIDustin" <dustin@...>
        To: <perl-beginner@yahoogroups.com>
        Sent: Monday, February 03, 2003 12:47 AM
        Subject: [PBML] Simple Chomping question


        I have an array, and each element has a newline at the end. How can I get
        rid
        of the newline after each element without making a loop to rebuild each
        element?

        I was hoping that @data = chomp(@data); would work, but it didnt appear to.

        Thanks

        GIDustin

        --
        My Home Page: http://www.gidustin.net
        Alternate: http://www.civ3files.com
        --
        When NASA first started sending up astronauts, they quickly discovered that
        ballpoint pens would not work in zero gravity. To combat the problem, NASA
        scientists spent a decade and 12 Billion Dollars to develop a pen that
        writes
        in zero gravity, upside down, underwater, on almost any surface including
        glass
        and at temperatures ranging from below freezing to 300C.

        The Russians just used a pencil.
        --
        The 10 Commandments consit of 279 words.
        The Declaration of Independence is 300 words long.
        The EU Ordinance on the Import of Caramel Sweets consists of 25911 words...

        Unsubscribing info is here:
        http://help.yahoo.com/help/us/groups/groups-32.html

        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/





        Unsubscribing info is here:
        http://help.yahoo.com/help/us/groups/groups-32.html

        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      Your message has been successfully submitted and would be delivered to recipients shortly.