The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


String::Unique - A source of deterministic pseudorandom strings [DPS]. Objects of this class will generate a series of DPS of a set length for a set 2 char 'salt' [similar to UNIX crypt's salt] and resettable string that is assumed to be a date string [although this is not enforced].

Note that if the date string is changed, the object resets itself and begins to generate a new series for the new date string.


Version 1.10


    use String::Unique;

    my $dayrefs = String::Unique->new({characterCount => 11, salt => 'AT',});
    my $string = $dayrefs->getStringByIndex(9999);



Class constructor new

Requires a hash ref containing a salt, string length and date


Reset the day structure for date.


Return the unique string in the [index] sequence for the given date or today is date is not supplied. This seldom used class method is optimized for memory not speed.


Return [index] for the unique string in the sequence for the given dat. This seldom used class method is optimized for memory not speed.


The primary method of this class. In scalar context returns the next entry in the daily queue of pseudorandom strings, in list context returns the next entry and the day of year as a 3 digit string ie '012' == January 13th.


Private class method; sets up the queue for date $datestring


Private class method; returns the next unique string in date: $datstring-s Queue


Private class method; returns a candidate string

ident Class method ident returns a string that uniquely identifies the object supplied


 Christian Werner Sr, << <> >>


Please report any bugs or feature requests to bug-string-unique at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc String::Unique

You can also look for information at:


This module was adopted from the module Unique by the same author, developed for Wells Fargo, see license and copyright


Copyright 2007,2008 Wells Fargo, all rights reserved. Copyright 2011 Christian Werner Sr.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.