On the China Mobile Game channel, the player paradise game in the game player package is now available. As one of the developers, we have added so many classes that we can see the results and are excited. Haha, various PV and UV data statistics follow.
The leader asked: Can I still write Perl?
A: Yes.
After entering this company, Perl scripts are indeed involved, so they can be written in a little simple way. Therefore, I have completed the processing of the access_log logs explained by the leaders and posted them to my blog, for future memories.
This script mainly involves passing parameters when running the Perl Command Line, checking whether the file exists and creating it, and using some simple regular expressions.
#! /Usr/bin/perl </P> <p> # $ filename = "localhost_access_log.2011-06-16.txt"; <br/> # $ outname = "new ". $ filename; OPERATOR. <br/>######## used during testing ####################< br/> # $ outname = "New _ $ FILENAME "; <br/> # Open (file, $ filename) or die "can't open the file: $! /N "; <br/>######## used during testing ###################</P> <p >######## used in official use ###################< br/> # $ argv [0] command line parameters <br/> $ outname = "New _ $ argv [0]"; <br/> open (file, $ argv [0]) or die "can't open the file: $! /N "; <br/>######## used during official use ##################< br/> # Open (OUTFILE, ">>$ outname") or die "can't open the file: $! /N "; <br/> # determine whether the file exists <br/> unless (-e $ outname) <br/>{< br/> Print" file not found. then create it/N "; <br/> # create and write a file <br/> open (OUTFILE,"> $ outname ") or die" couldn't open $ outname: $! "; <Br/>}< br/> else <br/>{< br/> open (OUTFILE,"> $ outname ") or die "couldn't open $ outname: $! "; <Br/> Print" file found. /n "; <br/>}</P> <p> while ($ line = <File>) <br/>{< br/> # Replace [] in the row with null <br/> $ line = ~ S/['/[' | '/]' | '/"'] // G; <br/> # Replace spaces with, <br/> $ line = ~ S/,/g; </P> <p> # remove the last row <br/> $ line = substr ($ line, 0, length ($ line)-1); </P> <p> # string matching/wappetserver <br/> if ($ line = ~ /// Wappetserver/) <br/>{< br/> my @ ROW = Split (//, //, $ line ); <br/> $ row [6] = "/wappetserver/syssetting"; <br/> $ line = join (",", @ row ); <br/>}</P> <p> Print OUTFILE $ line. "/N"; <br/>}< br/> close file; <br/> close OUTFILE;