#!/usr/bin/perl use strict; use warnings; # Assumptions my $dir = '/home'; print "\$dir = [$dir]\n"; my $file = 'test.dat'; print "\$file = [$file]\n"; # Proceed my $regexpaaa=qq/-i -e \'\^AAA=\'/; print "\$regexpaaa = [$regexpaaa]\n"; my @command2 = ("ssh us\@ip -o BatchMode=yes grep $regexpaaa $dir/$file"); print "\@command2:\n"; my $command2idx = 0; foreach my $command2 (@command2) { print " [$command2idx] = [$command2]\n"; $command2idx++; } exit;