Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2015
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post

    Read file line by line

    Hey everyone,

    I'm starting to learn PERL and this could be a very basic question.

    How can I open a file and get through it line by line, to check if there is a specific string on each line.

    Thanks in advance

  2. #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    3,359
    Thanks
    2
    Thanked 234 Times in 227 Posts
    How can I open a file
    Use the open function.

    and get through it line by line
    Use a while loop.

    check if there is a specific string on each line
    There are several ways to do that but the most common is to use a regex.
    perlrequick
    perlretut

  3. #3
    New Coder
    Join Date
    May 2015
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thanks


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •