Search Results

Search: Posts Made By: RedGrinGo
Forum: Programming 03-06-2011
2,200
Posted By radoulov
% perl -le' $str = "1, 2 ,3, 4,6 -10,11 -...
% perl -le'

$str = "1, 2 ,3, 4,6 -10,11 - 15,16, 17";

$str =~ s/(\d+)\s*-\s*(\d+)/@{[$1..$2]}/g;

print "==>>> $_" for split /[\s,]+/, $str;

'
==>>> 1
==>>> 2
==>>> 3
==>>> 4...
2,062
Posted By deindorfer
Perl: Unbuffered Keyboard Read to Exit Running Code
use Term::ReadKey;
ReadMode 4;

until ( ReadKey(-1) eq 'Q' ) {
... Your Program Here ...
}

ReadMode 0; # Reset tty before exiting
exit;



There you are, sir.
Showing results 1 to 2 of 2

 
All times are GMT -4. The time now is 04:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy