in reply to Matching patterns in condisional statements

Hi, think about it: how should someone assist you without some samples of what should match for each type of file? Please provide some sample data.

Also, you should use Perl to read the file, not shell out to a separate program executable.

Also, when you print $head, does it contain what you expect?


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Matching patterns in condisional statements
by smturner1 (Sexton) on Jul 05, 2017 at 17:41 UTC
    I cannot see why you would need a data sample since all I am doing is matching a string pattern with the file Header, so I can identify the file type. The string I am looking for can be found in the code. In the future I will use Perl, rather than shell to read the file. thank you. Originally, I thought that $head was storing the first line/header that I expected since it was printing to the screen, but it was actually storing in stdout. An issue that has been addressed and fixed my issue. Thank you for your input.
      I cannot see why you would need a data sample

      Because it allows for a completely reproduceable situation where someone wanting to help only has to copy/paste and not try to recreate input data by hand (and possibly get it wrong).

      Please see Short self-contained correct example.

        It's the converse. You are seeing if a then b. where a is your program and b is your problem. I think the monks want to see if b then a. ( the converse ) I'm definitely contra-positive about that.