Merging output of two commands for a third command

I'm not sure if this is even possible but I'm hoping to avoid generating a temporary file. What I'm trying to do is append a perl command to the start of a list created by grep, then send the entire thing to mail. This is mainly to ensure that something isn't wrong when the list is blank, but it will also help the list make more sense for the recipients.

So far I have this which gets the list and emails it:

grep 'student' inactive.list | mail -s "Old Student Accounts" $userlist

And this which gives me the date I need:

perl -e '($a,$b,$c,$d,$e,$f,$g,$h,$i)=localtime(time-86400*180);printf"Inactive as of %d\/%02d\/%02d\n",$e+1,$d,$f+1900'

Is this even possible or should I just use a temp file and delete it afterwards each time?

You can use this sort of structure:

( foo; bar; cat mumble; baz ) | whatever

That is exactly what I was looking for. Thank you so much!
:slight_smile: