我正在尝试使用 uuidgen (unix) 生成一个唯一编号。生成的唯一编号应存储在变量中。当我在函数中执行此操作时,我遇到了错误。
谁能让我知道如何在 perl 中使用 uuidgen 脚本。
#!/usr/bin/perl
sub function_uuidgen
{
my myuuid;
system(`export myuuid=uuidgen`);
print "\n unique id is : $myuuid";
# I need not to export the variable, I just need to unique number generated by UUID GENERATOR in a variable.
}
int main
{
print "\n I am in main function";
&function_uuidgen;
}
如下所述,当我运行 uuidgen 时,我面临以下错误。任何人都可以帮助我在 perl 中导出 JAVA VARIABLE 吗?如何导出路径变量,以防此错误与此有关。
错误 :
/bin/java: uuidgen 1: not found
代码 :
sub function_uuidgen
{
my $myuuid = qx(uuidgen);
chomp $myuuid;
print "\n unique id is : $myuuid";
# I need to export the variable, as it is giving me error without exporting.
}
int main
{
print "\n I am in main function";
function_uuidgen();
}