LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-06-2006, 09:24 AM   #1
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Rep: Reputation: 30
Perl question: Passing variable into function


Hi all

I am using the module HTML::TokeParser::Simple.

It currently works like i have below, where the input is a file.

How do I change it to accept a variable, multiline blob type of input?

Any help is appreciated. I do not understand how exactly the script will accept the file but not a variable input if i use a $_[0] for html_doc. Thinking i need the blob to have a @_[0] but an unable to figure out exactly how to get it. I am currently writing the file then reopening it I believe.

Code:
$remainingData = RemoveTags("$output_page");

sub RemoveTags {
  my $html_doc=shift;
  my $p = HTML::TokeParser::Simple->new ($html_doc);
  while ( my $token = $p->get_token ) {
    if( $token->is_text )
    {
       $temp = $token->as_is;

  #do stuff here.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about passing using a function in an if statement. RHLinuxGUY Programming 7 09-04-2006 04:13 PM
C++ / Passing a variable by reference to a class member function. sepulture Programming 12 11-15-2005 10:23 PM
Bash Script Passing variable to Function nutthick Programming 2 02-02-2005 05:15 AM
passing passing variable in Java as reference djgerbavore Programming 3 11-10-2004 02:18 PM
Question about function with variable number of parameters xailer Programming 4 01-13-2004 11:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration