Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Scanning multiple files from Snort rules one by one and extracting a particular part to another file - File Handling

by GrandFather (Saint)
on Jul 22, 2015 at 07:05 UTC ( [id://1135810]=note: print w/replies, xml ) Need Help??


in reply to Scanning multiple files from Snort rules one by one and extracting a particular part to another file - File Handling

First, well done for using strictures. They are going to help a lot in sorting out problems with your code as you develop it.

Your immediate issue is you need to add my in front of each variable when you first assign a value to it.

However, you have a long way to go to get your code complete. I suspect you haven't any chance to complete it within the time you have available. You should talk to your lecturer/tutor about the help you need.

We can give you some hints, but obviously just providing a solution is not going to help in the long run. Here are a few hints that will help write reliable software using Perl:

  • Use indentation to clearly show nested blocks of code
  • Use three parameter open and lexical file handles: open my $fIn, '<', $ruleFile or die "Can't open $ruleFile: $!\n";
  • Use Perl's built in functions instead of executing command line tools. Perl's functions will work across most operating systems and are generally more robust against changes in the OS and shell.
Update: fixed missing ',' in sample open code - thanks Laurent_R
Premature optimization is the root of all job security
  • Comment on Re: Scanning multiple files from Snort rules one by one and extracting a particular part to another file - File Handling
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1135810]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-23 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found