Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Seekers of Perl Wisdom

( #479=superdoc: print w/ replies, xml ) Need Help??

If you have a question on how to do something in Perl, or you need a Perl solution to an actual real-life problem, or you're unsure why something you've tried just isn't working... then this section is the place to ask. Post a new question!

However, you might consider asking in the chatterbox first (if you're a registered user). The response time tends to be quicker, and if it turns out that the problem/solutions are too much for the cb to handle, the kind monks will be sure to direct you here.

User Questions
Acce sing single element without args
1 direct reply — Read more / Contribute
by Anonymous Monk
on Mar 30, 2015 at 22:56

    to be more precise. Here is the code of a sub

    sub interface_control { my $s = shift; my (@r, $v, @h); $s->get_handles(rtrs=>\@r, vars=>\$v, hosts=>\@h);

    get_handles returns the handle for the args specified. These args are stored as hash/key pair in a file

    Call to the sub is made via interface_control($s)

    MY question is , i want to specifically access, one of the element in the array @r, say only $r[0]. Is there a way to access this or pass any reference to interface_control call

Controlling input and output of different program
2 direct replies — Read more / Contribute
by rkrasowski
on Mar 30, 2015 at 18:10
    Hi Monks, again, seems like simple problem but I can't solve this. I would like to control one program (that is normally controlled from terminal) with perl program. So , I understand there are few ways of managing it. I started with reading output of the program using pipes and I can not do it. Here is an example of what I am talking about:
    # open my $READ, "-|", "./dialog.pl"; while (<$READ>) { print $_; } close $READ;
    Here is the dialog.pl program that I am trying to interact with:
    print "How old are you? "; my $age = <>; print "You are $age.";
    The way I understand first program will open dialog.pl program and display "How old are you?" in the terminal,but it is not the case. What is the issue here? I would like to catch output from dialog.pl , and respond to it. I also understand that I will have to fork the program to be able to do writing and reading from dialog.pl at the same time. Thanks like always. Robert
Replace bits
1 direct reply — Read more / Contribute
by newbiecali
on Mar 30, 2015 at 17:35
    Hi

    i am newbie to Perl and need to learn from starting
    i have very big file of data (3Gb)like below


    00101100
    00101101
    11H00101
    HHHHHHHH
    01011001
    LLLLLLLL
    1011010L
    0110111L
    00000000
    00111111


    i need to replace H to 1 in column3 and L to 0 in column 8
    only so the file looks like below

    00101100
    00101101
    11100101
    HHHHHHHH
    01011001
    LLLLLLL0
    10110100
    01101110
    00000000
    00111111


    can it take text file "file1.txt"
    and spit out the output in "output.txt"
    something like that

    i will appreciate any help

    Thanks

Most Efficient Way to match this
2 direct replies — Read more / Contribute
by jmneedhamco
on Mar 30, 2015 at 16:40

    I am reading in a file whose line looks like this:

    userid:access_stuff:more_foo...

    My script needs to match a string in a variable which happens to be a userid and I need to match the userid in the file...first "word" to that first colon.

    example: userid matches userid so bale.

    So, basically, the jist is: 1) the following code is my idea (it is paraprhased, because I am not going to actually write the code for opening files, etc here.) 2) I need to figure out the most efficient way to code the idea of: "if line to first colon matches variable".

    if($linefraq eq $user) { return; #or otherwise abort from sub } else { #do whatever to the file }

    The linefraq variable would hold just the userid "substring" from the line read from the file. Of course, in practice, each line will be read and checked for the userid.

    Thank-you for your help!

cpan issues on 5.16
2 direct replies — Read more / Contribute
by gg48gg
on Mar 30, 2015 at 16:38
    Trying to insall pretty much any module and having issues. This is a new install of RHEL7. Here is an example of trying to install IO::Prompt. Thanks in advance for your help.
    root@mwuxadmdr1:/root/.cpan/build/Want-0.25-4nSUJ9 $ cpan -i IO::Prompt Reading '/root/.cpan/Metadata' Database was generated on Mon, 30 Mar 2015 03:29:01 GMT Running install for module 'IO::Prompt' Running make for D/DC/DCONWAY/IO-Prompt-0.997002.tar.gz Checksum for /root/.cpan/sources/authors/id/D/DC/DCONWAY/IO-Prompt-0.9 +97002.tar.gz ok CPAN.pm: Building D/DC/DCONWAY/IO-Prompt-0.997002.tar.gz Created MYMETA.yml and MYMETA.json Creating new 'Build' script for 'IO-Prompt' version '0.997002' Building IO-Prompt DCONWAY/IO-Prompt-0.997002.tar.gz ./Build -- OK Running Build test t/00.load.t .......... 1/1 # Failed test 'use IO::Prompt;' # at t/00.load.t line 4. # Tried to use 'IO::Prompt'. # Error: Can't locate loadable object for module Want in @INC (@I +NC contains: /root/.cpan/build/IO-Prompt-0.997002-bPjKIQ/blib/lib /ro +ot/.cpan/build/IO-Prompt-0.997002-bPjKIQ/blib/arch /usr/local/lib64/p +erl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/p +erl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /root/.cpan/ +build/IO-Prompt-0.997002-bPjKIQ/blib/lib/IO/Prompt.pm line 197. # Compilation failed in require at /root/.cpan/build/IO-Prompt-0.99700 +2-bPjKIQ/blib/lib/IO/Prompt.pm line 197. # BEGIN failed--compilation aborted at /root/.cpan/build/IO-Prompt-0.9 +97002-bPjKIQ/blib/lib/IO/Prompt.pm line 197. # Compilation failed in require at (eval 4) line 2. # BEGIN failed--compilation aborted at (eval 4) line 2. Use of uninitialized value $IO::Prompt::VERSION in concatenation (.) o +r string at t/00.load.t line 7. # Testing IO::Prompt # Looks like you failed 1 test of 1. t/00.load.t .......... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests t/01.dependencies.t .. ok t/pod-coverage.t ..... skipped: Test::Pod::Coverage 1.04 required for +testing POD coverage t/pod.t .............. skipped: Test::Pod 1.14 required for testing PO +D Test Summary Report ------------------- t/00.load.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=4, Tests=3, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.09 cusr + 0.02 csys = 0.14 CPU) Result: FAIL Failed 1/4 test programs. 1/3 subtests failed. DCONWAY/IO-Prompt-0.997002.tar.gz ./Build test -- NOT OK //hint// to see the cpan-testers results for installing this module, t +ry: reports DCONWAY/IO-Prompt-0.997002.tar.gz Running Build install make test had returned bad status, won't install without force root@mwuxadmdr1:/root/.cpan/build/Want-0.25-4nSUJ9 $ cpan -i Want Reading '/root/.cpan/Metadata' Database was generated on Mon, 30 Mar 2015 03:29:01 GMT Want is up to date (0.25). root@mwuxadmdr1:/root/.cpan/build/Want-0.25-4nSUJ9 $ perl -V Summary of my perl5 (revision 5 version 16 subversion 3) configuration +: Platform: osname=linux, osvers=2.6.32-504.1.3.el6.x86_64, archname=x86_64-li +nux-thread-multi uname='linux x86-020.build.eng.bos.redhat.com 2.6.32-504.1.3.el6.x +86_64 #1 smp fri oct 31 11:37:10 edt 2014 x86_64 x86_64 x86_64 gnulin +ux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOU +RCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 + -grecord-gcc-switches -m64 -mtune=generic -Dccdlflags=-Wl,--enable +-new-dtags -Dlddlflags=-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOUR +CE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 +-grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro -DDEBUGGING +=-g -Dversion=5.16.3 -Dmyhostname=localhost -Dperladmin=root@localhos +t -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -D +siteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/us +r/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share +/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64 +/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr +/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithread +s -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db + -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -D +installusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/le +ss -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_ +r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endserven +t_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustom +ize' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasin +g -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D +_FILE_OFFSET_BITS=64', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions +-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switc +hes -m64 -mtune=generic', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -f +stack-protector -I/usr/local/include' ccversion='', gccversion='4.8.3 20140911 (Red Hat 4.8.3-7)', gccos +andvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc', ldflags =' -fstack-protector' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread +-lc -lgdbm_compat perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.17' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,--en +able-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_F +ORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buf +fer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro ' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT +_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API USE_SITECUSTOMIZE Locally applied patches: Fedora Patch1: Removes date check, Fedora/RHEL specific Fedora Patch3: support for libdir64 Fedora Patch4: use libresolv instead of libbind Fedora Patch5: USE_MM_LD_RUN_PATH Fedora Patch6: Skip hostname tests, due to builders not being +network capable Fedora Patch7: Dont run one io test due to random builder fail +ures Fedora Patch9: Fix find2perl to translate ? glob properly (RT# +113054) Fedora Patch10: Fix broken atof (RT#109318) Fedora Patch13: Clear $@ before "do" I/O error (RT#113730) Fedora Patch14: Do not truncate syscall() return value to 32 b +its (RT#113980) Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#7 +7530) Fedora Patch16: Do not leak with attribute on my variable (RT# +114764) Fedora Patch17: Allow operator after numeric keyword argument +(RT#105924) Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984) Fedora Patch19: Do not crash when vivifying $| Fedora Patch20: Fix misparsing of maketext strings (CVE-2012-6 +329) Fedora Patch21: Add NAME headings to CPAN modules (CPANRT#7339 +6) Fedora Patch22: Fix leaking tied hashes (RT#107000) [1] Fedora Patch23: Fix leaking tied hashes (RT#107000) [2] Fedora Patch24: Fix leaking tied hashes (RT#107000) [3] Fedora Patch25: Fix dead lock in PerlIO after fork from thread + (RT#106212) Fedora Patch26: Make regexp safe in a signal handler (RT#11487 +8) Fedora Patch27: Update h2ph(1) documentation (RT#117647) Fedora Patch28: Update pod2html(1) documentation (RT#117623) Fedora Patch29: Document Math::BigInt::CalcEmu requires Math:: +BigInt (CPAN RT#85015) RHEL Patch30: Use stronger algorithm needed for FIPS in t/op/c +rypt.t (RT#121591) RHEL Patch31: Make *DBM_File desctructors thread-safe (RT#6191 +2) RHEL Patch32: Use stronger algorithm needed for FIPS in t/op/t +aint.t (RT#123338) Built under linux Compiled at Dec 1 2014 11:16:58 %ENV: PERL_MB_OPT="--install_base "/root/perl5"" PERL_MM_OPT="INSTALL_BASE=/root/perl5" @INC: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . root@mwuxadmdr1:/root/.cpan/build/Want-0.25-4nSUJ9 $ cpan Terminal does not support AddHistory. cpan shell -- CPAN exploration and modules installation (v1.9800) Enter 'h' for help. cpan[1]> o conf $CPAN::Config options from /root/.cpan/CPAN/MyConfig.pm: commit [Commit changes to disk] defaults [Reload defaults from disk] help [Short help about 'o conf' usage] init [Interactive setting of all options] applypatch [] auto_commit [0] build_cache [100] build_dir [/root/.cpan/build] build_dir_reuse [0] build_requires_install_policy [yes] bzip2 [/usr/bin/bzip2] cache_metadata [1] check_sigs [0] colorize_debug undef colorize_output [0] colorize_print undef colorize_warn undef commandnumber_in_prompt [1] commands_quote undef connect_to_internet_ok [1] cpan_home [/root/.cpan] curl undef dontload_hash undef dontload_list undef ftp undef ftp_passive [1] ftp_proxy [] ftpstats_period undef ftpstats_size undef getcwd [cwd] gpg [/usr/bin/gpg] gzip [/usr/bin/gzip] halt_on_failure [0] histfile [/root/.cpan/histfile] histsize [100] http_proxy [] inactivity_timeout [0] index_expire [1] inhibit_startup_message [0] keep_source_where [/root/.cpan/sources] load_module_verbosity [none] lynx undef make [/usr/bin/make] make_arg [] make_install_arg [] make_install_make_command [/usr/bin/make] makepl_arg [] mbuild_arg [] mbuild_install_arg [] mbuild_install_build_command [./Build] mbuildpl_arg [] ncftp undef ncftpget undef no_proxy [] pager [/usr/bin/less] password undef patch [/usr/bin/patch] patches_dir undef perl5lib_verbosity [none] prefer_external_tar [1] prefer_installer [MB] prefs_dir [/root/.cpan/prefs] prerequisites_policy [follow] proxy_pass undef proxy_user undef randomize_urllist undef scan_cache [atstart] shell [/bin/bash] show_unparsable_versions [0] show_upload_date [0] show_zero_versions [0] tar [/usr/bin/tar] tar_verbosity [none] term_is_latin [1] term_ornaments [1] test_report [0] trust_test_report_history [0] unzip [/usr/bin/unzip] urllist 0 [http://cpan.netnitco.net/] 1 [http://httpupdate3.cpanel.net/CPAN/] 2 [http://mirror.nyi.net/pub/CPAN/] use_sqlite [0] username undef version_timeout [15] wait_list undef wget [/usr/bin/wget] yaml_load_code [0] yaml_module [YAML] cpan[2]> q Terminal does not support GetHistory. Lockfile removed.
Can't copy file
4 direct replies — Read more / Contribute
by novice2015
on Mar 30, 2015 at 15:37

    I am a total beginner and have a script like this: It runs fine the only problem is it does not copy the data in output1.txt to output3.txt. It creates output3.txt but does not copy the data. Why?

    #!/usr/bin/perl my $server = `uname -n`; print $server; chomp $server; # Display all the files in /tmp directory. $dir = "/usr/ent/newdir/db/sign/*"; my @files = </usr/ent/newdir/db/sign/*files*>; open(my $outfh, '>', '/tmp/output1.txt') or die "cannot open file"; foreach $LINE (@files ){ print $outfh $LINE; close FH; } use File::Copy; {$oldlocation = "/tmp/output1.txt"; $newlocation = "/tmp/output3.txt"; copy($oldlocation, $newlocation); }
starters querry
4 direct replies — Read more / Contribute
by Mahadevk
on Mar 30, 2015 at 13:49
    Hello, I am starting to learn perl. when i go to run and type perl it opens but when i type the basic program $a=2; $b=$a + $a; print $b ; and then press enter i dont get any output.i thought i would get 4 as output. i want to know what i am doing wrong.need some help just to start. i tried going to perl critic but it gives error message on the first line.error message is 'code before strictures are enabled' some one please help.
Quick question: ForkManager
1 direct reply — Read more / Contribute
by pimperator
on Mar 30, 2015 at 12:53

    Hello Monks

    Quick question, I'm submitting a PBS job to the cluster that has a perl script with Parallel::ForkManager. In this script I want to fork off 32 processes for each file in an array I'm looping through.

    When I ask for  #PBS -l nodes=4:ppn=8

    does that mean that perl will fork off each process to run on each processor? Or do I need use threads;

Passing values to a Perl script from PHP
1 direct reply — Read more / Contribute
by Yary
on Mar 30, 2015 at 11:54
    I am posting this question & my response, which came into the CPAN::Testers list. This seems like a better place and I am directing the original poster to this node. Thanks to the fellow monks who helped this fellow out on the mailing list before now.

    On Sun, Mar 29, 2015 at 11:26 PM, Uday Shankar Kintali wrote:

    > Looking if I can pass on the user selected values ( in php form) to the perl script.

    Since you are calling the script using "system", there are a few general ways of getting the caller (PHP in this case) parameters to the callee (Perl):
    1. Environment variables. If you can set them in PHP before calling system, you ought to be able to retrieve them in Perl using $ENV{Env_var_name}, replacing "Env_var_name" with whatever environment variable you want to read. This seems the safest to me for simple use.
    2. Command-line arguments. If in PHP you run "system 'perl_script.pl arg0 arg1 arg2'", then Perl will have the arguments in @ARGV. $ARGV[0] eq 'arg0' && $ARGV[1] eq 'arg1', etc. Be careful if any of your arguments have spaces or shell-special characters like quotes, pipes- unless PHP has a form of "system" that takes care of those for you. Perl's "system" will do so, if you pass "system" a list or array instead of a string/scalar, but I don't know about PHP, and you are calling "system" from PHP.
    3. Pipe the data into Perl. A quick scan of PHP documentation says to do something like this:
      $handle = popen('PerlCode.pl','w'); fwrite($handle,"here is some input\n"); fwrite($handle,"more input\n"); # etc.... pclose($handle);
      and then in Perl you can read it like:
      while (<STDIN>) { # Do something with the line we just read }
    4. Some mutually agreed upon data store: a file, a database, shared-memory cache, etc. Need to be careful about handing the right data to the right process, if there's any chance of there being multi-process, and also careful about data lifetime- cleaning up old values, but not too soon. I won't go into the details here.
HTML Parser strange Null Character in data
3 direct replies — Read more / Contribute
by caind
on Mar 30, 2015 at 10:36
    Iím stuck, Iíve been trying to clean up my mistakes and I have a few I just canít seem to figure out. Maybe Iím too close, but I decided an extra set of eyes may be just what I need.

    I have written a script that will monitor the output of a database that is pushed to a website. Iím just scraping the site and then parsing the table. This is where I seem to run into a problem. First the site can take a little while to respond every now and then. This will shut down the script; I may have the solved with the goto statement. But, if there is a better way, Iím always willing to learn. Next either the data I get or the way I parse the table is putting a (? Space, Null, non-printable characterÖ..something It looks like the degree symbol followed by a middle dot į∙ ?) in front of the incident number only. Every now and then another column will have this happen and shutdown the script.. Iíve tried everything I can think of to the point of pulling out my hair. Now Iím just taking shots in the dark hoping something will hit. This will create a problem with naming and saving and recalling the file.

    BTW Iím not a developer; Iím just dangerous with a little bit of knowledge of Perl. So that being said I have a lot of gaps in my knowledge but Iím willing to learn.

    ### Script trimmed down ##### GET: getstore ('http://URL.com/tast.cfm?jump=true&dropboxvalue=0&nblock +=50&Sort_By=INC_Incident.IncidentNumber&Sort_Type=ASC&displayColumnLi +st=1,2,3,4,5,6,7', 'tempincid.html')or goto GET; my $html = 'tempincid.html'; my $te = HTML::TableExtract->new( headers => [("", "Incident # ", "Dispatch Time", "Incident Type", "Address", "Apt. #", "Postal Code", "Unit Dispatched")] ); $te->parse_file($html); $config{'header'} =<<"EOF"; <html> <head> <meta http-equiv="Content-Type" content="text/html"><title>ESSI | Onli +ne Home</title> <meta http-equiv="cache-control" content="no-cache" /> <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <META HTTP-EQUIV="REFRESH" CONTENT="15"> <link href="/Page_style/page.css" rel="stylesheet" type="text/css"></h +ead> <body> EOF my $file = "tempincid.html"; my $date = POSIX::strftime( "%c", localtime( ( stat $file )[9] ) ); my $row = @{$te->rows}; print $config{'header'}; print "<TABLE align=\"center\" border=\"1\" cellpadding=\"2\" cellspac +ing=\"0\" width=\"100%\" style=\"font-size: 12px;\">"; foreach my $ts ($te->tables) { foreach my $row ($ts->rows) { print "<tr><td> ", join(' </td><td> ', @$row), "\n"; ##### +####Every now and then the cell prints a stream of errors. I'm Guessi +ng it is that character I can identify #### print "</td></tr>" , "\n"; } } print "</Table>", "Dispatcher data last read $date", "</body></html>"; my $numColumns = @{$te->rows->[0]}; my $numRows = @{$te->rows}; for my $rowIndex ( 0..$numRows-3 ) { for my $columnIndex ( 0..$numColumns-1 ) { my $cellvalue = $te->rows->[$rowIndex][7]; foreach ($cellvalue) {chomp;} { $cellvalue=uc($cellvalue); if (($cellvalue =~ /BT/) || ($cellvalue =~ /FB/)) { my $path = "C:/incidentnum/"; my $cellmatch = $te->rows->[$rowIndex][$columnIndex]; #********************************************************************* +*********************############################## #---------------Read each cell and as they are opened trim all whitesp +aces from the left and right side-----------------# #------There is still some non-viewable (Null space, non-printable cha +racter to the left of the incident number.--------# ###################################################################### +################################################### my $cell1=$te->rows->[$rowIndex][1]; $cell1 =~ s/^\s+|\s+//g; $cell1 =~ s/^\s+|\s(?=\s)|\s+$//g; my $cell2=$te->rows->[$rowIndex][2]; $cell2 =~ s/^\s+|\s+$//g; my $cell3=$te->rows->[$rowIndex][3]; $cell3 =~ s/^\s+|\s+$//g; my $cell4=$te->rows->[$rowIndex][4]; $cell4 =~ s/^\s+|\s+$//g; my $cell5=$te->rows->[$rowIndex][5]; $cell5 =~ s/^\s+|\s+$//g; my $cell7=$te->rows->[$rowIndex][7]; $cell7 =~ s/^\s+|\s+$//g; my $row="$cell1, $cell2, $cell3, $cell4, $cell5, $cell7"; my $filename = $cell1."."."txt"; $filename =~ s/^\s+|\s+$//g; #$filename =~ s/^S+|\S+$//g; $path =~ s/^\s+|\s+$//g; $path =~ s/^\s+|\s(?=\s)|\s+$//g; my $full ="$path$filename"; open (FILE, '>', $filename) or die("Couldn't open $filename"); print FILE "$row"; close(FILE)or die $!; my $powershell = 'C:\Windows\System32\WindowsPowerShell\v1.0\p +owershell.exe'; my $mboxScript = 'C:\inetpub\cgi-bin\EmailAlert.ps1'; my $result = `$powershell -command "$mboxScript"`; print "$powershell\n"; print "$mboxScript\n"; goto EEND; } } } } EEND: exit 0;

Add your question
Title:
Your question:
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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (6)
    As of 2015-03-31 06:01 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When putting a smiley right before a closing parenthesis, do you:









      Results (660 votes), past polls