Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by Laurent_R (Canon)
on Jul 23, 2015 at 07:47 UTC ( [id://1135964]=note: print w/replies, xml ) Need Help??


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

Hi,

@rulefiles is an array containing the names of the *.rule" files in the folder.

for my $rulefile (@rulefiles) { # ... }
is a loop that goes over each of the items (file names) in the @rulefiles array, one after the other, assigns it to the $rulefile variable, so that each of the items can be manipulated with the $rulefile variable name within the body of the loop.

This is a simple example of a Perl one-liner using a similar construct:

$ perl -e 'for my $i (1, 4, 3, 2) { print "$i\n"; }' 1 4 3 2 $
In this example, the $i variable takes successively each value of the list (1, 4, 3, 2) and the body of the loop simply prints $i to the screen.
  • Comment on Re^3: 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://1135964]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found