问题在子程序之间传递数据 [英] Problem Passing data between subroutines

查看:52
本文介绍了问题在子程序之间传递数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿大家!

我回来了。

我有一个脚本处理我正在处理的网站的私人消息,我创建了一个子程序来处理发送消息。


我想查看是否发送字段留空,包含一个不存在的用户名或其中包含无效字符。


一切正常,直到我将消息发送到多个收件人。我所做的是创建另一个子程序来准备发送。即:循环遍历不同的用户名,并提取进程或尾随空格,并将它们发送到发送消息。子程序。


现在由于某种原因,它无法判断用户是否离开了to。字段空白。

无论perl认为$ recepient是什么是真实的。我试过了:

Hey everyone!
I am back.
I have a script that handles the private messaging for a site I am working on and I created a subroutine to handle the sending of a message.

I want to check if the "to" field was left blank, contains a user name that doesn''t exist or has invalid characters in it.

Everything worked fine, until I integrated the sending of messages to multiple recipients. What I did was create another subroutine to "prepare" the sending. ie: loop through the different user names, and extract proceeding, or trailing whitespace, and them send it to the "send message" subroutine.

Now for some reason it cannot tell if the user left the "to" field blank.
No matter what perl considers the "$recepient" to be true. I''ve tried:

展开 | 选择 | Wrap | 行号

推荐答案

recepient"是真实的。我试过了:

recepient" to be true. I''ve tried:

展开 | 选择 | Wrap | 行号


在sub prepSend结束时你有:

At the end of sub prepSend you have:

展开 | 选择 | Wrap | 行号


我建​​议您添加一些打印命令来观察脚本在运行时的运行情况已经完成了。
I suggest you add some print commands to watch what the script is doing while it runs if you haven''t done that already.


这篇关于问题在子程序之间传递数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆