foreach my $testdata (@R_input) { $testdata =~ /(Fisher's Exact Test for Cluster \d+ \([^\)]*\))/; $R_line0 = $1; $testdata =~ /(Test\d+ <-)/; $R_line1 = ($1.$add_whitespace); $testdata =~ /(matrix\(c\(\d+, \d+, \d+, \d+\),)/; $R_line2 = ($1.$add_whitespace); $testdata =~ /(nr = 2,)/; $R_line3 = ($1.$add_whitespace); $testdata =~ /(dimnames = list\(Row1 = c\("Col1", "Col2"\),)/; $R_line4 = ($1.$add_whitespace); $testdata =~ /(Row2 = c\("Col1", "Col2"\)\)\))/; $R_line5 = $1; $testdata =~ /(fisher.test\(Test\d+\))/; $R_line6 = $1; $R_send_0 = "$R_comment_out$R_line0"; $R_send_1 = "$R_line1$R_line2$R_line3$R_line4$R_line5"; $R_send_2 = "$R_dblquotation_start$R_line6$R_send_3"; my $r_send_comment = $R_send_0; my $r_send_string = $R_send_1; my $r_send_string2 = $R_send_2; $R->send (qq'$r_send_string'); $R->send (qq'$r_send_string2'); my $ret = $R->read; push (@R_output_store, $r_send_comment); push (@R_output_store, $ret); print $ret; print "\n\n"; }