in reply to Converting quoted strings to numbers in array

The "qw" means quote word(s). This is aide to help in typing in lots of strings. That's all it does.

If you want to mix decimal,octal,hex numbers in some @a=qw(...),see below. Just ask Perl to evaluate what that string means in terms of an actual "number".

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @array_of_strings = qw (10 20 0x47 1 30 0b011); # # "qw" is "quote word(s), this is the same as: # my @array_of_strings = ("10","20","0x47","1","30","0b011"); print Dumper \@array_of_strings; # only string context not "numbers" my @array = map{eval $_}@array_of_strings; # or my @array = map{eval $_} qw (10 20 0x47 1 30 0b011); print Dumper \@array; __END__ prints: $VAR1 = [ '10', '20', '0x47', '1', '30', '0b011' ]; $VAR1 = [ 10, 20, 71, 1, 30, 3 ];
Update: added a binary number to example.