in reply to Re^2: Problem With Split
in thread Problem With Split

Well the number changes each time so I couldn't just use int '0019'.
uh? so what's the problem? use int $num, like i showed you.
$num can be anything you want. this code will take a string consisting of digits with leading zeros and remove them. why would you think that it works only on the string '0019'?
Also my @splat = $thing =~ m/\d{4}/g; only sets @splt = ('1234');
see Happy-the-monk's answer. maybe your perl is broken.

Replies are listed 'Best First'.
Re^4: Problem With Split
by debiandude (Scribe) on Jun 16, 2004 at 14:27 UTC

    It's not that I thought it only worked on the string '0019'. When I had first typed you code and did:

    foreach (@splat) { print $_, "\n" }

    I only saw 1234 printed, so I figured you then wrote the int '0019' because @splat = $thing =~ m/\d{4}/g; only sets the first one. However, I did it again, I really don't know what I changed, but it worked this time.

    Thanks. And sorry for the confusion.