I have been playing with perl for a few months now and can do alot with it but these string matching / substitution things always get to me, thanks in advanced for any help. My problem:
I have a variable which can be something like:
my $var = "10 sometext, some more, and 3 more"
or
my $var = "1 sometext, some more, and 3 more"
now I have a new variable say:
$id = "1"
I want to say if the first number in $var i.e(10, 1) = $id then do something.
So what if I split the string $var at the FIRST space and assigned the number to $newvar. I think that will work but how do I code that?
I have a variable which can be something like:
my $var = "10 sometext, some more, and 3 more"
or
my $var = "1 sometext, some more, and 3 more"
now I have a new variable say:
$id = "1"
I want to say if the first number in $var i.e(10, 1) = $id then do something.
So what if I split the string $var at the FIRST space and assigned the number to $newvar. I think that will work but how do I code that?