Swap array value by using the sub range : Parameter « Subroutine « Perl
- Perl
- Subroutine
- Parameter
Swap array value by using the sub range
#!/usr/bin/perl -w
use strict;
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
print @months;
@months[3,4] = @months[4,3];
print @months;
Related examples in the same category