Re: head as in "unix"

2002-09-18 Thread Matt Simonsen
You could write your own function that is a for loop that counts until 100, putting each line into the array and quits would work. There may be a more elegant way, though... Matt On Wed, 2002-09-18 at 09:31, Jakob Kofoed wrote: > > Hi there, > > Does Perl have a function like the UNIX head.

Preferred way to move and compress a file

2002-09-26 Thread Matt Simonsen
I need to move several files and compress them - what's the preferred way to do this? I don't think Zlib::Compress is what I want, it seems more geared towards dealing with small streams... although I suppose I could look over each line and write that out. The files to compress are all several h

Parse data file

2002-10-01 Thread Matt Simonsen
I need to get 2 fields out of a file which has the following format: #FIELD [tab]NAME=name to put into hash[newline] [tab]DATALINE=value to put with data[newline] [tab]EXTRA=several fields to ignore... [NEWLINE] #NEXTFIELD [tab]NAME ... I have thought of a couple ways I *could* do it, but I th

Re: Parse data file

2002-10-01 Thread Matt Simonsen
On Tue, 2002-10-01 at 05:34, Janek Schleicher wrote: > Matt Simonsen wrote at Tue, 01 Oct 2002 01:00:41 +0200: > > > I need to get 2 fields out of a file which has the following format: > > I put a real clip below ... should be more helpful. > What is the exact data you

Re: Time CHange Regulatr expression for 2am Crons ?

2002-10-25 Thread Matt Simonsen
On Fri, 2002-10-25 at 19:44, Scot wrote: > Anybody figured out a good regular expression to match all > 2am crons ? match 0,10,20,30,40,50 2 * * * and 0 2 * * * Wouldn't \S+\s2\s\S\s\S\s\S.* or something like that work? In other words, just search for 5 fields where the second one was "2" No

query string into hash?

2002-11-13 Thread Matt Simonsen
I need to get all the words in a query (q=___) out of a (URL, I think) encoded string. Example line and my current plan: $queryString = 'pp=20&q=Finance/Banking/Insurance&qField=All&qMatch=any&qSort=smart&view=1' my %querys = $queryString =~ /(\S+)=(\S+)&?/g ; #Here I could use a tip on how to

Write hash of hashes to disk?

2002-11-15 Thread Matt Simonsen
I've tried using DB_File open a hash and write a hash of hashes to disk, but this failed. I read in Perl Cookbook to "just use it as a regular hash" but from what I can tell this is not possible when speaking of complex structures like a hash of hashes. I'm currently dumping this structure to disk

Re: query a ph nameserver plus backtick question

2002-12-02 Thread Matt Simonsen
On Mon, 2002-12-02 at 12:42, [EMAIL PROTECTED] wrote: > > Are backticks bad, and if so what are the alternatives if I need to > return information to a variable? They're not as "cross platform" as using pure Perl, but that's not always possible (or at least easy) so sometimes it's "better" to u

multi line comments

2002-12-11 Thread Matt Simonsen
I believe there are no multi-line comments in Perl. Do any of you have a good hack to fake these? Thanks Matt -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

proper way to start daemon

2002-05-16 Thread Matt Simonsen
I have a script to monitor servers which is basically an infinate loop that sleeps and runs again. I start from a ssh session by the command: ssh -f $server "~/script &" It seems to be dieing on some of our busier servers. I'm guessing this is because I'm not doing it properly... but I'm not su

proper way to start daemon

2002-05-16 Thread Matt Simonsen
I have a script to monitor servers which is basically an infinate loop that sleeps and runs again. I start from a ssh session by the command: ssh -f $server "~/script &" It seems to be dieing on some of our busier servers. I'm guessing this is because I'm not doing it properly... but I'm not

How to get single scalar to function cleanly

2002-05-21 Thread Matt Simonsen
I have the following code to parse the line at the bottom of the email. Basically I want to take the date and convert it into something easy to say "is this within the last _ days" - the part of this that I think is particularly sloppy is the whole parsing below the split. Any tips (in particu

Re: How to get single scalar to function cleanly

2002-05-21 Thread Matt Simonsen
On Tuesday 21 May 2002 17:01, Eric Beaudoin wrote: > You can pass more than one parameter to ParseDate. > > my $date = ParseDate(@secureFields[0..2]) > Doh! Yes, that's exactly what I want. I was trying @secureFields[1-3] - my obvious (now) mistake was not using the .. Thanks Matt -- To unsubs

Re: perl graphics editing

2002-07-18 Thread Matt Simonsen
This isn't a Perl solution (unless you run it from a perl script...) but it'll work. Use mogrify, part of the imagemagic software suite one command will do the whole trick. Matt On Thu, 2002-07-18 at 11:56, David Gerler wrote: > Hi, > I have searched cpan using ppm looking for a packag

Best way to split log

2002-08-19 Thread Matt Simonsen
I'm wondering what people would suggest as the best way to split this so it respects the "" and [] as fields yet doesn't kill performance? 1.2.3.4 - - [15/Aug/2002:06:43:39 -0700] "GET /usr/123 HTTP/1.0" 200 38586 "http://www.careercast.com/js.php"; "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98

Best way to split log

2002-08-20 Thread Matt Simonsen
I'm wondering what people would suggest as the best way to split this so it respects the "" and [] as fields yet doesn't kill performance? 1.2.3.4 - - [15/Aug/2002:06:43:39 -0700] "GET /usr/123 HTTP/1.0" 200 38586 "http://www.careercast.com/js.php"; "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98