Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Signature rotation.

by Juerd (Abbot)
on May 23, 2002 at 07:12 UTC ( [id://168683]=note: print w/replies, xml ) Need Help??


in reply to Signature rotation.

$/ = "%";

Why not "\n%\n"?

Oh, and just because I like Tie::File and strict, and dislike using /dev/urandom, here's an alternative implementation:

#!/usr/bin/perl -w use Tie::File; use IO::File; use Fcntl qw(O_RDONLY); use strict; chdir '/home/hagus'; tie my @fortunes, 'Tie::File', '.signatures.rot', mode => O_RDONLY, re +csep => "\n%\n"; IO::File->new('.signature', 'w')->print($fortunes[rand @fortunes]);

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

Replies are listed 'Best First'.
Re: Re: Signature rotation.
by hagus (Monk) on May 23, 2002 at 07:35 UTC
    Great! I like this.

    I've never used Tie before actually, so this is good sample code for me.

    Why not "\n%\n" ? Because I coded that in about 3 nanoseconds, and it didn't even occur to me. Maybe some C oriented portion of my brain baulked at using more than one character as a separator?!

    I think I had a reason for using /dev/urandom instead of rand. Who wants to remind me what it was? I've forgotten.

    --
    Ash OS durbatulk, ash OS gimbatul,
    Ash OS thrakatulk, agh burzum-ishi krimpatul!
    Uzg-Microsoft-ishi amal fauthut burguuli.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://168683]
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: (1)
As of 2024-04-24 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found