{"id":130,"date":"2020-02-12T10:36:39","date_gmt":"2020-02-12T10:36:39","guid":{"rendered":"https:\/\/www.lcn.com\/support\/knowledge-base\/how-to-create-a-perl-script\/"},"modified":"2020-03-05T09:22:59","modified_gmt":"2020-03-05T09:22:59","slug":"how-to-create-a-perl-script","status":"publish","type":"ht_kb","link":"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/","title":{"rendered":"How to create a Perl script"},"content":{"rendered":"<p>Perl is a general-purpose programming language used for a wide range of tasks including web development. If you want to find out more about Perl take a look this <a href=\"http:\/\/perldoc.perl.org\/perlintro.html\" target=\"_blank\" rel=\"noopener noreferrer\">introduction to Perl<\/a> and the <a href=\"http:\/\/www.perl.org\/docs.html\" target=\"_blank\" rel=\"noopener noreferrer\">online documentation<\/a>.<\/p>\n<p>You can use any plain text editor to create a Perl script (e.g. Windows &#8211; notepad, Mac &#8211; textedit). Normally you would also install the Perl interpreter on your computer as well so that you can test the scripts you write. Lets take a look a very simple Perl script:<\/p>\n<pre class=\"prettyprint linenums\">#!\/usr\/bin\/perl\n\nprint \"Content-type: text\/plain\\n\\n\";\nprint \"Hello world!\";<\/pre>\n<p><\/br><strong>Line 1<\/strong> &#8211; This tells the web server where and what to pass the script to for processing.<\/p>\n<p><strong>Line 3<\/strong> &#8211; Because we will be requesting this script in a web browser we need to tell it what type of content we are going to send it, in this case plain text. Normally you would want to return HTML content and would use text\/html instead.<\/p>\n<p><strong>Line 4<\/strong> &#8211; Here we print back our line of content.<\/p>\n<div class=\"support_note\">\n<h3>Note<\/h3>\n<p>Each line of Perl code is called a statement, and ends with a semi-colon to signify it is a complete statement.<\/p>\n<\/div>\n<p>Open your text editor and type the code above into it (without the line numbers), and save it to a file called <i>hello_world.cgi<\/i>.<\/p>\n<div class=\"support_note\">\n<h3>Note<\/h3>\n<p>When creating the script, be sure to ASCII mode not binary as the script will not work otherwise.<\/p>\n<\/div>\n<p>Next upload your <i>hello_world.cgi<\/i> script to the <strong>web\/cgi-bin<\/strong> on your web hosting using <a href=\"\/support\/articles\/how-to-upload-files-to-your-website-with-ftp\" target=\"blank\" rel=\"noopener noreferrer\">FTP<\/a>.<\/p>\n<p>Using your FTP program set the permissions for your cgi script to <strong>755<\/strong>. Follow our <a href=\"\/support\/articles\/how-to-change-file-permissions-via-ftp\" target=\"blank\" rel=\"noopener noreferrer\">How to change file permissions via FTP<\/a> guide for instructions on how to do this.<\/p>\n<p>Now load up the script in your web browser e.g. http:\/\/www.domain.com\/cgi-bin\/<i>hello_world.cgi<\/i> (replace domain.com with your domain name)If all goes well you should see <strong>&#8216;Hello world!&#8217;<\/strong> at the top of your screen. If not check out the <a href=\"\/support\/articles\/troubleshooting-common-perl-issues\" target=\"blank\" rel=\"noopener noreferrer\">Perl troubleshooting guide<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Perl is a general-purpose programming language used for a wide range of tasks including web development. If you want to find out more about Perl take a look this introduction to Perl and the online documentation. You can use any plain text editor to create a Perl script (e.g. Windows &#8211; notepad, Mac &#8211; textedit). [&hellip;]<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"open","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[15],"ht-kb-tag":[5],"class_list":["post-130","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-creating-a-new-website","ht_kb_tag-web-hosting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to create a Perl script - LCN.com<\/title>\n<meta name=\"description\" content=\"How to create a Perl script at LCN.com.Follow this easy step-by step-guide to create a simple Perl script.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create a Perl script - LCN.com\" \/>\n<meta property=\"og:description\" content=\"How to create a Perl script at LCN.com.Follow this easy step-by step-guide to create a simple Perl script.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/\" \/>\n<meta property=\"og:site_name\" content=\"Customer Support Guides - LCN\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/lcndotcom\" \/>\n<meta property=\"article:modified_time\" content=\"2020-03-05T09:22:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/support-facebook-feed.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@lcndotcom\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/\",\"url\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/\",\"name\":\"How to create a Perl script - LCN.com\",\"isPartOf\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#website\"},\"datePublished\":\"2020-02-12T10:36:39+00:00\",\"dateModified\":\"2020-03-05T09:22:59+00:00\",\"description\":\"How to create a Perl script at LCN.com.Follow this easy step-by step-guide to create a simple Perl script.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.lcn.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to create a Perl script\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.lcn.com\/support\/#website\",\"url\":\"https:\/\/www.lcn.com\/support\/\",\"name\":\"Customer Support Guides - LCN\",\"description\":\"- LCN\",\"publisher\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.lcn.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.lcn.com\/support\/#organization\",\"name\":\"LCN.com\",\"url\":\"https:\/\/www.lcn.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg\",\"contentUrl\":\"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg\",\"width\":461,\"height\":461,\"caption\":\"LCN.com\"},\"image\":{\"@id\":\"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/lcndotcom\",\"https:\/\/x.com\/lcndotcom\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create a Perl script - LCN.com","description":"How to create a Perl script at LCN.com.Follow this easy step-by step-guide to create a simple Perl script.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/","og_locale":"en_US","og_type":"article","og_title":"How to create a Perl script - LCN.com","og_description":"How to create a Perl script at LCN.com.Follow this easy step-by step-guide to create a simple Perl script.","og_url":"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/","og_site_name":"Customer Support Guides - LCN","article_publisher":"https:\/\/www.facebook.com\/lcndotcom","article_modified_time":"2020-03-05T09:22:59+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/support-facebook-feed.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@lcndotcom","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/","url":"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/","name":"How to create a Perl script - LCN.com","isPartOf":{"@id":"https:\/\/www.lcn.com\/support\/#website"},"datePublished":"2020-02-12T10:36:39+00:00","dateModified":"2020-03-05T09:22:59+00:00","description":"How to create a Perl script at LCN.com.Follow this easy step-by step-guide to create a simple Perl script.","breadcrumb":{"@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.lcn.com\/support\/articles\/how-to-create-a-perl-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lcn.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to create a Perl script"}]},{"@type":"WebSite","@id":"https:\/\/www.lcn.com\/support\/#website","url":"https:\/\/www.lcn.com\/support\/","name":"Customer Support Guides - LCN","description":"- LCN","publisher":{"@id":"https:\/\/www.lcn.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lcn.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.lcn.com\/support\/#organization","name":"LCN.com","url":"https:\/\/www.lcn.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg","contentUrl":"https:\/\/www.lcn.com\/support\/wp-content\/uploads\/2020\/02\/ZF_-hcc3.jpg","width":461,"height":461,"caption":"LCN.com"},"image":{"@id":"https:\/\/www.lcn.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/lcndotcom","https:\/\/x.com\/lcndotcom"]}]}},"_links":{"self":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":2,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/130\/revisions"}],"predecessor-version":[{"id":451,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb\/130\/revisions\/451"}],"wp:attachment":[{"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb-category?post=130"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.lcn.com\/support\/wp-json\/wp\/v2\/ht-kb-tag?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}