我们如何在Perl中创建唯一ID [英] How we can create a Unique Id in Perl
本文介绍了我们如何在Perl中创建唯一ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个 UniqueId .有没有我可以调用的函数,以便每次使用该函数时,都会给我一个新ID,且始终具有不同的值?
I want to create a UniqueId. Is there a function I can call, such that every time when I use that it will give me a new Id, always with a different value?
推荐答案
更好的方式也可以使用
use UUID::Generator::PurePerl;
sub create_search_id {
my $this =shift;
my $args=shift;
my $ug = UUID::Generator::PurePerl->new();
my $uuid1 = $ug->generate_v1();
return $uuid1;
}
从这里您可以了解 查看全文