#!/usr/bin/env perl use strict; use warnings; use Statistics::R; my @numbers = ( 1 .. 10 ); my $R = Statistics::R->new(); $R->set( 'x', \@numbers ); $R->run( q`x = x ^ 2` ); my $squares = $R->get('x'); print "@$squares"; __END__ 1 4 9 16 25 36 49 64 81 100