K
khan
Hi,
Iam new to Perl Script, am writing a perl script to read a
configuration file and take some actions accordingly. I read each line
of file, split the line in to variables and compare against the
predefined tokens. Comparison fails if variable in file has some
spaces around it.
Eg: Line read from file
Jhon: jack:hill;
spilt(/:/);
if("jack" eq "$_[1])
#Above comparison fails as $_[1] value is " jack"
Please let me know a solution to compare string variables ignoring
spaces around the variables.
Thanks,
-Mushtaq Khan
Iam new to Perl Script, am writing a perl script to read a
configuration file and take some actions accordingly. I read each line
of file, split the line in to variables and compare against the
predefined tokens. Comparison fails if variable in file has some
spaces around it.
Eg: Line read from file
Jhon: jack:hill;
spilt(/:/);
if("jack" eq "$_[1])
#Above comparison fails as $_[1] value is " jack"
Please let me know a solution to compare string variables ignoring
spaces around the variables.
Thanks,
-Mushtaq Khan