Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:47:49+00:00 2026-06-09T08:47:49+00:00

I am new to Perl and I am currently trying to split a string

  • 0

I am new to Perl and I am currently trying to split a string only on a couple of letter.
I have looked at the other answers and they seem to be specific to that problem or there is lack of comments to understand the answer.

The ultimate goal is to split up a very long CSV file into receptive sections which can then be used later on. The sample data would is

HOME 123454 monkey lion 6.4.2.10 ( ABCD EFGH (Tue 20th August 2000) 12345 True )<br />HOME 123454 monkey lion 6.4.2.10 ( ABCD EFGH (Tue 20th August 2000) 12345 True )<br />

I would look to split the string by the “< br /> into there own strings which would then store the strings in an array. So far what I have tried to split the string is:

my $line1 = split("/<br />", $Line);

and testing it trying by printing out the output, but it doesn’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:47:50+00:00Added an answer on June 9, 2026 at 8:47 am

    The split function returns the number of splits in scalar context. To get the list of splits, one needs to call split in list context:

    my $str   = q{HOME 123454 monkey lion 6.4.2.10 ( ABCD EFGH (Tue 20th August 2000) 12345 True )<br />HOME 123454 monkey lion 6.4.2.10 ( ABCD EFGH (Tue 20th August 2000) 12345 True )<br />};
    my @lines = split qr{<br\s?/>}, $str;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to perl, and can't seem to find answers about this anywhere.
Im new to perl, so sorry if this is obvious, but i looked up
I am new to Java and i am currently rewriting a Perl code in
I currently have some code which returns a sites header content back: #!/usr/bin/perl use
I'm quite new to Perl and I'm trying to build a hash recursively and
We are currently maintaining a Perl web application and we are slowly trying to
I have a perl script that is used to monitor databases and I'm trying
I'm new to this as I come from C++ and Perl background. Trying to
I'm new to Perl, currently writing a Perl script to automatically fill web forms
I have some Perl code that translates new-lines and line-feeds to a normalized form.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.