40 users online (1 members and 39 guests)  


  Results 1 to 4 of 4

Related

  1. explain    Forum: CGI Perl Forum
    Replies: 1
  2. HI explain me about shift @_    Forum: CGI Perl Forum
    Replies: 1
  1. #1
    ben_mccune's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2005
    Location
    Missouri
    Posts
    2

    Can someone please explain how to add this.

    Do not think the whole code is needed as all I want to do is change a snippet or two in the code and unsure how to do it coorectly. Here is the portion that is of concern what is in BOLD is not in the code but the part I am wanting to edit.

    #Save back new content
    open(FREELINKS,">$freelinks");
    foreach $line (@arrfreelinks)
    {
    print FREELINKS "$line";
    if ($line =~ "--newentries$category--")
    {
    print FREELINKS "\n - <a href=$url target=new>$title</a><br>\n"; What I want is the $url and new to be formatted with the " " symbols around them to be XHTML correct is this possible?
    }
    }
    close(FREELINKS);

    print "Content-type: text/html\n";
    $flinks = "$freelinksurl\n\n";
    print qq(Location: $flinks);
    return;I am getting a error here, "Can't return outside a subroutine at line 83" do not know how to fix any help?

    The script does work and do what it is suppose to do. Just trying to clean up the code a bit. Again did not post all the script, just the issue parts.

    thanks

  2. #2
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Can someone please explain how to add this.

    I am no perl expert but I can help with the first problem.

    Code:
    print FREELINKS "\n - <a href=$url target=new>$title</a><br>\n"; What I want is the $url and new to be formatted with the " " symbols around them to be XHTML correct is this possible? 
    }
    }
    close(FREELINKS);
    change to:

    Code:
    print FREELINKS "\n - <a href='$url' target='new'>$title</a><br />\n"; What I want is the $url and new to be formatted with the " " symbols around them to be XHTML correct is this possible? 
    }
    }
    close(FREELINKS);
    I also added a space/ to the line break for xhtml compliance.

    In order for somebody to help you with the second issue will probably require the script code and a link or source code for the output.

    Dave

  3. #3
    ALL's Avatar
    Super Dooper Nerd

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    Re: Can someone please explain how to add this.

    dave, you are partialy correct, that will work, but there is a much eassier way...
    Code:
    #Save back new content
    open(FREELINKS,">$freelinks");
    foreach $line (@arrfreelinks)
    {
    print FREELINKS "$line";
    if ($line =~ "--newentries$category--")
    {
    print FREELINKS "\n - <a href=\"$url\" target=\"new\">$title</a><br>\n";
    }
    }
    close(FREELINKS); 
    
    $ret .= "Content-type: text/html\n";
    $flinks = "$freelinksurl\n\n";
    $ret .= "Location: $flinks";
    return $ret;
    try that!

  4. #4
    ben_mccune's Avatar
    New User

    Status
    Offline
    Join Date
    Aug 2005
    Location
    Missouri
    Posts
    2

    Re: Can someone please explain how to add this.

    Thank you both, works now... Knew it was something stupid I was missing, brain fart....



Tags for this Thread