FYI.. playing with it a bit. I discovered there must be a carriage return (new line) after the line processes. I changed my original code to do this
chomp(my $date = `date +%d/%b`);
This fixed the problem. hehehe... I should have thought of this. Oh well.. not bad after a few weeks of perl coding
So now I've learned a few new ways to pull stuff into perl.
Thx guys!
R. Joseph Newton wrote:
u235sentinel wrote:
While I've already done this with a simple shell script using grep, I was trying to figure out how I can do the same thing in perl.
I have an access_log from my apache web server and while I can manually enter a date for my pattern match (which works fine), I can't seem to get it automated properly. I suspect the $date variable may be passing `date +%d/%b` instead of 26/Dec to the pattern matching if statement.
FYI... when I run the program I pass the name of the file I want parsed ( example: code.pl access_log )
Any thoughts on my mistake?
Thx
---------------------
Script I'm using.
#!/usr/bin/perl
$date=`date +%d/%b`;
Since you have a question about what the $date variable contains, here would be an excellent place to: print "I see the date as $date\n";
Let us know what prints.
Joseph
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>