Hi everyone,
could you help me out again ?
Let's say I got the following strings stored in a file input.txt :
First I tried to read all the values into an array:
But this gave me only 2 values:
Next I changed it to scalar reading:
Same output ...
How can I solve this problem ?
What if the value separator is not a blank but something else (e.G. a ; or a -) ?
Best Regards,
Thomas
could you help me out again ?
Let's say I got the following strings stored in a file input.txt :
Code:
Value1 Value2 Value3 Value4
Value5 Value6 Value7 Value8
First I tried to read all the values into an array:
Code:
open (IN1, "input.txt");
@values = <IN1>;
foreach (@values)
{
print "Here is a single value: ", $_, "\n":
}
But this gave me only 2 values:
Code:
Here is a single value: Value1 Value2 Value3 Value4
Here is a single value: Value5 Value6 Value7 Value8
Next I changed it to scalar reading:
Code:
open (IN1, "input.txt");
while (<IN1>)
{
print "Here is a single value: ", $_, "\n":
}
Same output ...
Code:
Here is a single value: Value1 Value2 Value3 Value4
Here is a single value: Value5 Value6 Value7 Value8
How can I solve this problem ?
What if the value separator is not a blank but something else (e.G. a ; or a -) ?
Best Regards,
Thomas