Visit Our UNIX and Linux User Community

Define multiple mail recipents in a variable in perl

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Define multiple mail recipents in a variable in perl
# 1  
Old 11-10-2009
Define multiple mail recipents in a variable in perl


I have a perl script from which I call a shell script and pass mail variable to it.
The mail works fine if I give 1 recipient but fails for multiple.
$mialing = "anu\"   $mialing
mail -s "hi" $1

This works fine

But I need to define multiple recipents in mailing variable.

$mialing = "anu\ anu2\ anu3\"

space does not work.
Please help how to define this


Last edited by pludi; 11-10-2009 at 07:55 AM.. Reason: code tags, please...
# 2  
Old 11-10-2009
quote the argument.....

Code: "$mialing"

# 3  
Old 11-10-2009
Code: $mialing

rly works ^^?
should be ` $mialing` or system( $mialing)

and why need those \@ ?
and actualy u dont need at all..

foreach(@mialing){`mail -s "hi" $_`}

P.S. if foreach not works use for
P.P.S. hope u not gonna spam my box with this script..

Previous Thread | Next Thread
Test Your Knowledge in Computers #52
Difficulty: Easy
A magnetic disc array is an example of offline storage.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl multiple qr assigned to variable

Experts, I'm having problems with the code below. I'm trying to test $var2 for two different regexs. I thought it could be done per below, but I'm getting the following error when running. $ ./ b fed50c0100**** Unescaped left brace in regex is deprecated, passed through in regex; marked... (2 Replies)
Discussion started by: timj123
2 Replies

2. Shell Programming and Scripting

To define a sender name in mail command

Hi, I am using the unix script to send a report on daily basis using the mail command. Here the sender name is appearing as myname i.e. chandru ( Is there any way to change sender name as a user defined name? example i need to change it to SupportTeam... (1 Reply)
Discussion started by: schandru
1 Replies

3. Shell Programming and Scripting

Define variable from file.

HI I have file A.txt _1A _2A _3A _4A I want define all as different variable. $1A=_1A $2B=_2A $3C=_3A $4D=_4A Now i can use any variable in my script. (3 Replies)
Discussion started by: pareshkp
3 Replies

4. Shell Programming and Scripting

In Perl can i define a hash with value as variable?

Hi, Is it possible in perl to have a hash defined with variables as theirs key values, like: %account = ('username' => 'boy', 'password' => $password); Thanks (1 Reply)
Discussion started by: zing_foru
1 Replies

5. Shell Programming and Scripting

Perl - match e-mail addresses in multiple files

Hi, I'm trying to write a script that will check multiple files in a directory (all the relevant filenames begin "TT04.NOTES") for e-mail addresses, and then print these addresses to screen with a count at the bottom. I'm a bit of a novice with Perl but thought it would be the best tool for the... (2 Replies)
Discussion started by: wf1974
2 Replies

6. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

7. Shell Programming and Scripting

Multiple variable in a variable in Perl

Hi All, I am trying to convert the below Csh while loop into Perl while loop but the problem is that in this csh script, i have 2 variables inside a variable -> $count is a variable {SB$count} as a whole is another variable. Csh is able to assign values to such variable like the below but i do... (3 Replies)
Discussion started by: Raynon
3 Replies

8. UNIX for Dummies Questions & Answers

#define in perl

Hi friends, I am not sure if perl questions can be raised here. :rolleyes: But I have a doubt if there is a way to do "#define" in perl, like in C. Does anyone know if it is feasible (without CPAN modules)? Thanks, Srini (7 Replies)
Discussion started by: srinivasan_85
7 Replies

9. UNIX for Dummies Questions & Answers

define length of variable

I have a variable with a value of "05". When I add one to that variable, using the command: CURR_YY=`expr $CURR_YY + 1`, I get the value of "6", losing the leading zero (which is needed for passing to another script). How do I keep the leading zero? Thank you! (10 Replies)
Discussion started by: cbarker
10 Replies

Featured Tech Videos