[英]i want configure one of the column in csv file and its the value of the variable is already fetched from a config file in perl
I have a csv file from where I fetching the data line by line and calling the function and giving the value.. I just want one of the value in the csv file configurable so I put the $ sign but its value is not interpreted in the program and I already added the the same value into the program so that it can take that value. 我有一个csv文件,可从该文件中逐行获取数据并调用该函数并提供值。.我只是想将csv文件中的值之一配置为可配置的,所以我将$符号放在了其中,但在程序,我已经在程序中添加了相同的值,以便可以使用该值。
from a csv file I getting the value as: 从一个CSV文件,我得到的价值是:
1, TC_6.01_UA_CREATE_USER ,$create_user_command
this is the function:- 这是功能:-
sub function{
# $create_user_command --this is the global variable
# that i take from the config file ;
print "$create_user_command";
# it is showing the command-- create user
my $tc_name = $_[1];
print "test case name : $tc_name\n";
my $test_command = $_[2];
# the value at the second index $_[2]is the value
# from the csv file that i want to configure
print "test case command: $test_command\n";
# this is just simply printing the value from csv
# i.e $create_user_command but not interpreting it
print "$test_command\n";
}
I just want how to interpret that $create_user_command
value from the csv.. please help me in this 我只想如何从csv解释
$create_user_command
值。请在此帮助我
You way wish to use eval. 您希望使用eval。
perldoc -f eval perldoc -f评估
Use eval with care, it will run arbitrary code and can bite you very badly. 谨慎使用eval,它将运行任意代码,并且可能对您造成严重伤害。 Check that the value of $create_user_command is something you understand and not something like:
检查$ create_user_command的值是否可以理解,而不是:
$create_user_command = "qx(rm -rf /)"; # BAD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.