No I did not have warnings on.
my $pattern = '\\Aaudit'; my $no_file_error ="TRUE"; my @dir_files = $ftp->dir($ftp_directory); $Data::Dumper::Useqq=1; print Dumper($pattern); my $netrc = Net::Netrc->lookup($ftp_server) or die ("Could not find lo +gin info in .netrc for $ftp_server"); my $ftp = Net::FTP->new($ftp_server, Port => $ftp_server_port, De +bug => 1) or die ('Could not create ftp object'); $ftp->login($netrc->login, $netrc->password) or die ('Could not l +og in'), $ftp->message; $ftp->binary(); #print directory of files before command print "--------------------First List all files------------------ +\n"; my @dir_files = $ftp->dir($ftp_directory); foreach my $list(@dir_files){ print "$list\n"; } @dir_files = grep { $_ =~ /$pattern/ } @dir_files; if (@dir_files == 0) { if ($no_file_error eq "TRUE") { print "No files exist with that $pattern\n"; } else { print "Send Email: Cannot find files to GET for parameter $pat +tern"; }} else { for my $list(@dir_files){ print "$ftp_command $list\n"; } }
I added data::dumper and warnings Output with audit
$VAR1 = "audit"; Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.63) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.31) Net::FTP>>> IO::Handle(1.28) Net::FTP=GLOB(0xaec9e8)<<< 220 Titan FTP Server 11.20.2264 Ready. Net::FTP=GLOB(0xaec9e8)>>> USER xupromgr Net::FTP=GLOB(0xaec9e8)<<< 331 User name okay, need password. Net::FTP=GLOB(0xaec9e8)>>> PASS .... Net::FTP=GLOB(0xaec9e8)<<< 230-Welcome xupromgr from 10.253.2.119. You + are now logged in to the server. Net::FTP=GLOB(0xaec9e8)<<< 230 User logged in, proceed. Net::FTP=GLOB(0xaec9e8)>>> TYPE I Net::FTP=GLOB(0xaec9e8)<<< 200 Type set to I. --------------------First List all files------------------ Net::FTP=GLOB(0xaec9e8)>>> PASV Net::FTP=GLOB(0xaec9e8)<<< 227 Entering Passive Mode (10,253,1,56,236, +13). Net::FTP=GLOB(0xaec9e8)>>> LIST /AS/testftp Net::FTP=GLOB(0xaec9e8)<<< 150 File status okay; about to open data co +nnection. Net::FTP=GLOB(0xaec9e8)<<< 226 Closing data connection. Transferred 41 +5 bytes. drw-rw---- 1 xupromgr xupromgr 512 Mar 29 08:04 . drw-rw---- 1 xupromgr xupromgr 512 Mar 28 13:54 .. -rw-rw---- 1 xupromgr xupromgr 18 Feb 27 14:21 no_audit.txt -rw-rw---- 1 xupromgr xupromgr 18 Feb 27 14:21 no_audit_date +.txt -rw-rw---- 1 xupromgr xupromgr 10 Feb 27 14:08 auditsample.t +xt -rw-rw---- 1 xupromgr xupromgr 11 Feb 27 14:21 audit_date.tx +t get -rw-rw---- 1 xupromgr xupromgr 18 Feb 27 14:21 no_audit. +txt get -rw-rw---- 1 xupromgr xupromgr 18 Feb 27 14:21 no_audit_ +date.txt get -rw-rw---- 1 xupromgr xupromgr 10 Feb 27 14:08 auditsamp +le.txt get -rw-rw---- 1 xupromgr xupromgr 11 Feb 27 14:21 audit_dat +e.txt
This list is what is outputted with ^audit
$VAR1 = "^audit"; Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.63) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.31) Net::FTP>>> IO::Handle(1.28) Net::FTP=GLOB(0x1cdf9e8)<<< 220 Titan FTP Server 11.20.2264 Ready. Net::FTP=GLOB(0x1cdf9e8)>>> USER xupromgr Net::FTP=GLOB(0x1cdf9e8)<<< 331 User name okay, need password. Net::FTP=GLOB(0x1cdf9e8)>>> PASS .... Net::FTP=GLOB(0x1cdf9e8)<<< 230-Welcome xupromgr from 10.253.2.119. Yo +u are now logged in to the server. Net::FTP=GLOB(0x1cdf9e8)<<< 230 User logged in, proceed. Net::FTP=GLOB(0x1cdf9e8)>>> TYPE I Net::FTP=GLOB(0x1cdf9e8)<<< 200 Type set to I. --------------------First List all files------------------ Net::FTP=GLOB(0x1cdf9e8)>>> PASV Net::FTP=GLOB(0x1cdf9e8)<<< 227 Entering Passive Mode (10,253,1,56,235 +,244). Net::FTP=GLOB(0x1cdf9e8)>>> LIST /AS/testftp Net::FTP=GLOB(0x1cdf9e8)<<< 150 File status okay; about to open data c +onnection. Net::FTP=GLOB(0x1cdf9e8)<<< 226 Closing data connection. Transferred 4 +15 bytes. drw-rw---- 1 xupromgr xupromgr 512 Mar 29 08:04 . drw-rw---- 1 xupromgr xupromgr 512 Mar 28 13:54 .. -rw-rw---- 1 xupromgr xupromgr 18 Feb 27 14:21 no_audit.txt -rw-rw---- 1 xupromgr xupromgr 18 Feb 27 14:21 no_audit_date +.txt -rw-rw---- 1 xupromgr xupromgr 10 Feb 27 14:08 auditsample.t +xt -rw-rw---- 1 xupromgr xupromgr 11 Feb 27 14:21 audit_date.tx +t No files exist with that ^audit
This is with the variable set to \\Aaudit
$VAR1 = "\\Aaudit"; Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.63) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.31) Net::FTP>>> IO::Handle(1.28) Net::FTP=GLOB(0x18539e8)<<< 220 Titan FTP Server 11.20.2264 Ready. Net::FTP=GLOB(0x18539e8)>>> USER xupromgr Net::FTP=GLOB(0x18539e8)<<< 331 User name okay, need password. Net::FTP=GLOB(0x18539e8)>>> PASS .... Net::FTP=GLOB(0x18539e8)<<< 230-Welcome xupromgr from 10.253.2.119. Yo +u are now logged in to the server. Net::FTP=GLOB(0x18539e8)<<< 230 User logged in, proceed. Net::FTP=GLOB(0x18539e8)>>> TYPE I Net::FTP=GLOB(0x18539e8)<<< 200 Type set to I. --------------------First List all files------------------ Net::FTP=GLOB(0x18539e8)>>> PASV Net::FTP=GLOB(0x18539e8)<<< 227 Entering Passive Mode (10,253,1,56,236 +,32). Net::FTP=GLOB(0x18539e8)>>> LIST /AS/testftp Net::FTP=GLOB(0x18539e8)<<< 150 File status okay; about to open data c +onnection. Net::FTP=GLOB(0x18539e8)<<< 226 Closing data connection. Transferred 4 +15 bytes. drw-rw---- 1 xupromgr xupromgr 512 Mar 29 08:04 . drw-rw---- 1 xupromgr xupromgr 512 Mar 28 13:54 .. -rw-rw---- 1 xupromgr xupromgr 18 Feb 27 14:21 no_audit.txt -rw-rw---- 1 xupromgr xupromgr 18 Feb 27 14:21 no_audit_date +.txt -rw-rw---- 1 xupromgr xupromgr 10 Feb 27 14:08 auditsample.t +xt -rw-rw---- 1 xupromgr xupromgr 11 Feb 27 14:21 audit_date.tx +t No files exist with that \Aaudit

In reply to Re^2: Perl Regex \A or ^ Not Working by thundercat
in thread Perl Regex \A or ^ Not Working by thundercat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.