Hello! I'm a little new to Perl, have to take it as a course for my major (which has little to do with Perl?) and I need a bit of help with a program I need to create. I have to scout a series of "log" files to find certain logs that were made during January of 2006. This is what I have so far:
#!/usr/bin/perl use strict; use warnings; my $dir = "."; opendir (my $dh, $dir ) or die "Cannot open dir '$dir' :$!\n"; my @files; while (my $file = readdir($dh) ) { push (@files, $file); } closedir($dh); my @secure_files; @secure_files = grep (/^secure (\. \d{1,2})?$/, @files);
I believe this takes all of the logs I'm looking for specifically and puts them in an array, but to be honest I'm just copying some code my professor sent us and modifying it in a few places (he told us to do this, I'm not cheating I promise). Basically, I'm a little unsure of how to proceed with the rest of the program. I have to take logs that were made in January (which I plan on doing using basic regex) and then putting them into a file labeled secure.200601. Thanks ahead of time, I appreciate the assistance.
In reply to Need help copying "logs" to another file. by REsaY
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |