in reply to Match into scalar

Ahem. Your code (formatted)
my $call = `mminfo -r 'volume,state,written,%used,space,pool,location, +ssinsert' -q 'ssinsert <= three week ago`; foreach ($call) { if ( $call =~ /Daily\S+\s/) { print "Daily true $_ .\n"; } else { print "not found\n "; } }

raises a question. What is your backtick mminfo command giving back? a bunch of lines? If so, they are a single long string which you assign to $call. Then you iterate over that string, which gets aliased as $_ inside the loop, do a match and output just all the stuff your backtick command returned. The foreach loop is executed once.

Want to iterate over the lines your mminfo yields? Break that string up with split. Then your code would look like

my @calls = split /\r?\n/, `mminfo -r 'volume,state,written,%used,spac +e,pool,location,ssinsert' -q 'ssinsert <= three week ago`; foreach $call (@calls) { if ( $call =~ /Daily\S+\s/) { print "Daily true $call .\n"; } else { print "not found\n "; } }

<update> You can also say @calls = `cmd`, the output of cmd will be split with $/ (see perlvar).</update>

Another way to do that is using a pipe open:

my $cmd = 'mminfo -r 'volume,state,written,%used,space,pool,location,s +sinsert' -q 'ssinsert <= three week ago'; open CMD, "$cmd |" or die "Can't run '$cmd': $!\n"; while (<CMD>) { if (/Daily\S+\s/) { print "Daily true $_"; } else { print "not found\n "; } }

Use captures if you don't want the whole line but part of it, e.g.

if (/Daily(\S+)\s/) { print "Daily true $1\n"; }

See perlre, perlretut.

And append updates to your post, don't change the original content without a proper note, since you render the replies already given to you useless. Read the PerlMonks FAQ, section Posting on PerlMonks, there How do I change/delete my post?.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}