in reply to Split an array -> store contents into a scalar up till a certain character

I'm not exactly sure as to how you have the value of 25.255.2.0 stored, but if this is a scalar string, you can split it into array of the constituent components through use of the split command. These array elements can then be assigned to the individual scalars thus:

my ( $scalar_1, $scalar_2, $scalar_3, $scalar_4 ) = split /\./, '25.25 +5.2.0';

If however the individual components of the string 25.255.2.0 are already stored in separate array elements, then the following should suffice:

my ( $scalar_1, $scalar_2, $scalar_3, $scalar_4 ) = @array;

 

perl -e 'print+unpack("N",pack("B32","00000000000000000000000111010100")),"\n"'