I am getting the following error when I run the code,strangely if set the variable as $8k_m,if I remove the number "8" and change the variable as "$k_m",I see the error is gone,what am I doing wrong?

Error:- Bareword found where operator expected at ftp.pl line 15, near "$8k_m" (Missing operator before k_m?) Can't use global $8 in "my" at ftp.pl line 15, near "my $8" syntax error at ftp.pl line 15, near "$8k_m" Execution of ftp.pl aborted due to compilation errors. #!/usr/bin/perl -w use strict; use warnings; use Cwd qw(getcwd); use File::Copy; use File::Find; use Net::Telnet; use Net::FTP; use Getopt::Std; my %options=(); getopt("b",\%options); my $cwd = getcwd; my $8k_m= $options{b}; my ($input,$output); my %files = map {$_ => 1} qw(amss.mbn dsp.elf); find(sub { copy($File::Find::name, $cwd) or die "Can't cp $File::Find::name: +$!" if (delete $files{$_}); }, $8k_m); print "\nFTP.ing Modem and DSP images...\n"; my $ftp = Net::FTP->new("10.42.9.119", Debug => 0) or die "Cannot connect to the target: $@"; $ftp->login("user","user") or die "Cannot login ", $ftp->message; $ftp->cwd("/mnt/data") or die "Cannot change working directory ", $ftp->message; $ftp->binary(); $ftp->put("data.mbn") or die "put failed ", $ftp->message;; $ftp->put("file.elf") or die "put failed ", $ftp->message; $ftp->quit();

In reply to Error when adding a number to a variable by Anonymous Monk

Title:
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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.