Sponsored Content
Full Discussion: [Perl] Printing - Scalars
Top Forums Shell Programming and Scripting [Perl] Printing - Scalars Post 302345132 by NDxiak on Tuesday 18th of August 2009 01:22:07 PM
Old 08-18-2009
[Perl] Printing - Scalars

Hey Guys,

I have some weird problem with printing scalars ...
When I'm executing script both are printing in terminal ...
But only one is printed to the file ?

I don't know whats going on .. Smilie

Btw .. I'm noobie Smilie took me lots of time to put this simple script together Smilie

Thank you in advance

Code:
#!/usr/bin/perl 


 open (FILE, ">data.txt"); 
 open (FILE2, ">data2.txt"); 

 $content = get("http://lcoalhost/test.html");
 die "Couldn't get it!" unless defined $content;

($plain_text = $content) =~ s/<[^>]*>//gs;    


 $mystringa = "$plain_text";
if($mystringa =~ m/Start(.*?)End/) {
    print $1;
}



 $mystringb = "$plain_text";
if($mystringb =~ m/Word(.*?)\(/) {
    print $2;
}


print "$1\n";
print "$2\n";

print FILE $1; 
print FILE $2; 
print FILE2 "$plain_text";


Last edited by NDxiak; 08-18-2009 at 03:18 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

comparing scalars contaning "DOUBLE QUOTES" as data

Hello to all, Does anyone know the solution ? Two strings A and B are present. I want to check whether B is a Substring of A. 1. The value of A is - 29 * * * /bin/ls "test" "tmp*" "log*" (Note: Pl note that A contains DOUBLEQUOTES, ASTERISK & FRONTSLASH) 2. The value of B is -... (5 Replies)
Discussion started by: rssrik
5 Replies

2. UNIX for Dummies Questions & Answers

Perl, printing a string into columns

How can I use Perl to a take a string of 10 characters and print the last five characters of the string in columns 1-5 and the first five in columns 6-10? Result: 0123456789 5 0 6 1 7 2 8 3 9 4 (5 Replies)
Discussion started by: doubleminus
5 Replies

3. Shell Programming and Scripting

Perl printing error

Hi Scripting Gurus, I am new bee in perl, and trying to write a script which must print the free disk space availability of C and E drives. Please advice. Here is the script snippet and expected output: #!/usr/bin/perl use CGI qw/:html3 :standard/; $spaceuselog =... (4 Replies)
Discussion started by: ccsaviour
4 Replies

4. Shell Programming and Scripting

Need help in printing a sql query in perl

Hi All, I have the following sql query select abcd from udbadm.log where xyz='1'. I have 16k queries similar to this with different values for xyz. I want to print the values of 'abcd' for each row. I have the following perl code, but not sure how i can print that particular... (1 Reply)
Discussion started by: userscript
1 Replies

5. Shell Programming and Scripting

Printing between 2 matches with Perl

Can we please modify this perl one-liner to print lines between pattern1 and pattern2 in a file? Currently it prints lines till pattern2. (4 Replies)
Discussion started by: anand_bh
4 Replies

6. Emergency UNIX and Linux Support

Perl - Retrieving and Printing Security Token

My script below is supposed to log in to my vB account on any vB forum I'm registered on and retrieve + print my security token. However it seems to be hit and miss. The logging in works perfectly just will not retrieve and print the security token for every forum I log in to. Code Below: ... (3 Replies)
Discussion started by: AndrewTwain
3 Replies

7. Shell Programming and Scripting

Perl: selective printing of lines

Hi, I have a file with lines like this. 2 7 18 ggcgt anna 2 7 18 hhchc sam 3 7 18 hhdjcc ross 4 7 18 hhcjd jenny 0 8 21 jjdhs sam 3 8 21 kkok bush 2 9 24 kosss BrenhamIf the values of the second column are equal, print only those lines with the least first column value. So in... (5 Replies)
Discussion started by: polsum
5 Replies

8. Shell Programming and Scripting

help with perl database printing

Hey guys i am using perl and trying to pull a list of books from a database and then populate the list in a separate TT2 file. When the list is generated there should be 39 book names. When I do the foreach statement in my tt2 below, the first statement gives me 39 Array(random number) and the... (1 Reply)
Discussion started by: Joey12
1 Replies

9. Shell Programming and Scripting

Need help in Perl Script for printing next line

I got multiple of documents in which i have to extract a line coming after a ID..The scenario is Customer ID: none VT : 002/89 Customer ID: Yes VT: 001/89 Customer ID: none VT: 006/85 Customer ID: Yes VT: 003/56 I have to extract the id which is coming after YES..The output... (7 Replies)
Discussion started by: rajkrishna89
7 Replies

10. Shell Programming and Scripting

Printing a message in file without opening it in perl

Hello friends, i have a perl script as below ... for (0 ..$#values) { ##want to print some message here in Report.txt file print `find /abc/xyz/pqr/$values" -type f -ls` >> Report.txt } I am able to get output of print `find /abc/xyz/pqr/$values" -type f -ls` >> Report.txt in... (2 Replies)
Discussion started by: harpal singh
2 Replies
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_rr_print, ldns_rdf_print, ldns_pkt_print, ldns_rr_list_print, ldns_resolver_print, ldns_zone_print- SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> void ldns_rr_print(FILE *output, const ldns_rr *rr); void ldns_rdf_print(FILE *output, const ldns_rdf *rdf); void ldns_pkt_print(FILE *output, const ldns_pkt *pkt); void ldns_rr_list_print(FILE *output, const ldns_rr_list *list); void ldns_resolver_print(FILE *output, const ldns_resolver *r); void ldns_zone_print(FILE *output, const ldns_zone *z); DESCRIPTION
ldns_rr_print() Prints the data in the resource record to the given file stream (in presentation format) output: the file stream to print to rr: the resource record to print Returns void ldns_rdf_print() Prints the data in the rdata field to the given file stream (in presentation format) output: the file stream to print to rdf: the rdata field to print Returns void ldns_pkt_print() Prints the data in the DNS packet to the given file stream (in presentation format) output: the file stream to print to pkt: the packet to print Returns void ldns_rr_list_print() print a rr_list to output output: the fd to print to list: the rr_list to print ldns_resolver_print() Print a resolver (in sofar that is possible) state to output. output: the fd to print to r: the resolver to print ldns_zone_print() Print a zone structure * to output. Note the SOA record is included in this output output: the fd to print to z: the zone to print AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_rr2str, ldns_rdf2str, ldns_pkt2str, ldns_rr_list2str, ldns_key2str. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)
All times are GMT -4. The time now is 06:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy